学生列表的导出
This commit is contained in:
parent
db9d4900ac
commit
23f1c3175c
|
@ -1383,27 +1383,32 @@ class CoursesController < ApplicationController
|
|||
#sheet1.row(0).default_format = blue
|
||||
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
|
||||
sheet1[0,0] = "课程编号"
|
||||
sheet1[0,1] = course.id
|
||||
sheet1[1,0] = "课程学期"
|
||||
sheet1[1,1] = course.time.to_s+"年"+course.term
|
||||
sheet1[2,0] = "课程名称"
|
||||
sheet1[2,1] = course.name
|
||||
sheet1[3,0] = "教师团队"
|
||||
sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、')
|
||||
sheet1[4,0] = "主讲教师"
|
||||
sheet1[4,1] = course.teacher.show_name
|
||||
sheet1[5,0] = "排名"
|
||||
sheet1[5,1] = "学生姓名"
|
||||
sheet1[5,2] = "昵称"
|
||||
sheet1[5,3] = "学号"
|
||||
sheet1[0,1] = course.syllabus.id
|
||||
sheet1[1,0] = "课程名称"
|
||||
sheet1[1,1] = course.syllabus.title
|
||||
sheet1[2,0] = "班级编号"
|
||||
sheet1[2,1] = course.id
|
||||
sheet1[3,0] = "班级学期"
|
||||
sheet1[3,1] = course.time.to_s+"年"+course.term
|
||||
sheet1[4,0] = "班级名称"
|
||||
sheet1[4,1] = course.name
|
||||
sheet1[5,0] = "教师团队"
|
||||
sheet1[5,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、')
|
||||
sheet1[6,0] = "主讲教师"
|
||||
sheet1[6,1] = course.teacher.show_name
|
||||
sheet1[7,0] = "排名"
|
||||
sheet1[7,1] = "学生姓名"
|
||||
sheet1[7,2] = "昵称"
|
||||
sheet1[7,3] = "学号"
|
||||
for i in 0 ... homeworks.count
|
||||
sheet1[5,i+4] = "第"+(i+1).to_s+"次"
|
||||
sheet1[7,i+4] = "第"+(i+1).to_s+"次"
|
||||
end
|
||||
sheet1[5,homeworks.count+4] = "作业得分"
|
||||
sheet1[5,homeworks.count+5] = "测评得分"
|
||||
sheet1[5,homeworks.count+6] = "社区得分"
|
||||
sheet1[5,homeworks.count+7] = "总得分"
|
||||
count_row = 6
|
||||
sheet1[7,homeworks.count+4] = "作业得分"
|
||||
sheet1[7,homeworks.count+5] = "测评得分"
|
||||
sheet1[7,homeworks.count+6] = "社区得分"
|
||||
sheet1[7,homeworks.count+7] = "总得分"
|
||||
sheet1[7,homeworks.count+8] = "分班"
|
||||
count_row = 8
|
||||
members.each_with_index do |member, i|
|
||||
sheet1[count_row,0]= i+1
|
||||
sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s
|
||||
|
@ -1427,34 +1432,39 @@ class CoursesController < ApplicationController
|
|||
sheet1[count_row,homeworks.count+5] = ex_score
|
||||
sheet1[count_row,homeworks.count+6] = act_score
|
||||
sheet1[count_row,homeworks.count+7] = sum.round(2)
|
||||
sheet1[count_row,homeworks.count+8] = member.course_group_id == 0 ? "暂无" : member.course_group.name
|
||||
count_row += 1
|
||||
end
|
||||
|
||||
homeworks.each_with_index do |home, i|
|
||||
sheet = book.create_worksheet :name => "第#{i+1}次作业"
|
||||
sheet[0,0] = "课程编号"
|
||||
sheet[0,1] = course.id
|
||||
sheet[1,0] = "课程学期"
|
||||
sheet[1,1] = course.time.to_s+"年"+course.term
|
||||
sheet[2,0] = "课程名称"
|
||||
sheet[2,1] = course.name
|
||||
sheet[3,0] = "教师团队"
|
||||
sheet[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、')
|
||||
sheet[4,0] = "主讲教师"
|
||||
sheet[4,1] = course.teacher.show_name
|
||||
sheet[4,0] = "作业批次"
|
||||
sheet[4,1] = "第#{i+1}次作业"
|
||||
sheet[4,0] = "作业名称"
|
||||
sheet[4,1] = home.name
|
||||
sheet[0,1] = course.syllabus.id
|
||||
sheet[1,0] = "课程名称"
|
||||
sheet[1,1] = course.syllabus.title
|
||||
sheet[2,0] = "班级编号"
|
||||
sheet[2,1] = course.id
|
||||
sheet[3,0] = "班级学期"
|
||||
sheet[3,1] = course.time.to_s+"年"+course.term
|
||||
sheet[4,0] = "班级名称"
|
||||
sheet[4,1] = course.name
|
||||
sheet[5,0] = "教师团队"
|
||||
sheet[5,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、')
|
||||
sheet[6,0] = "主讲教师"
|
||||
sheet[6,1] = course.teacher.show_name
|
||||
sheet[6,0] = "作业批次"
|
||||
sheet[6,1] = "第#{i+1}次作业"
|
||||
sheet[6,0] = "作业名称"
|
||||
sheet[6,1] = home.name
|
||||
if home.homework_type == 1 #普通作业
|
||||
if home.anonymous_comment ==0
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 6
|
||||
count_row = 8
|
||||
items = home.student_works.order("work_score desc")
|
||||
items.each_with_index do |stu, j|
|
||||
sheet[count_row,0]= j + 1
|
||||
|
@ -1480,13 +1490,13 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
elsif home.homework_type == 2 #编程作业
|
||||
if home.anonymous_comment ==0
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
sheet.row(7).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_name),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 6
|
||||
count_row = 8
|
||||
items = home.student_works.order("work_score desc")
|
||||
items.each_with_index do |stu, j|
|
||||
sheet[count_row,0]= j + 1
|
||||
|
@ -1513,13 +1523,13 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
elsif home.homework_type == 3 #分组作业
|
||||
if home.anonymous_comment ==0
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
sheet.row(7).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
else
|
||||
sheet.row(5).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
sheet.row(7).concat([l(:excel_rank),l(:excel_group_member),l(:excel_homework_name),l(:excel_homework_project),l(:excel_homework_des),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
||||
end
|
||||
count_row = 6
|
||||
count_row = 8
|
||||
items = home.student_works.order("work_score desc")
|
||||
items.each_with_index do |stu, j|
|
||||
sheet[count_row,0] = j + 1
|
||||
|
|
Loading…
Reference in New Issue