dev_bj
cxt 5 years ago
parent 77cee20dc6
commit d3b2e47dc0

@ -2562,248 +2562,248 @@ class CoursesController < ApplicationController
count_row += 1
end
homeworks.where(:homework_type => 4).each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[2,0] = "教师团队"
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"
sheet[3,1] = "#{i+1}"
sheet[3,0] = "作业名称"
sheet[3,1] = home.name
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
count_row = 5
items = home.score_student_works
# if items.count == 0 && home.publish_time < Time.now && !course.is_end
# update_shixun_work_status home
# items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
# end
items.each_with_index do |stu, j|
sheet[count_row,0]= j + 1
sheet[count_row,1] = stu.user.show_real_name
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.late_penalty
sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,7] = format_time(stu.commit_time)
count_row += 1
end
end
homeworks.where(:homework_type => 1).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.name
sheet[2,0] = "教师团队"
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"
sheet[3,1] = "#{i+1}"
sheet[3,0] = "作业名称"
sheet[3,1] = home.name
if home.anonymous_comment ==0
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),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(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),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 = 5
items = home.score_student_works
items.each_with_index do |stu, j|
sheet[count_row,0]= j + 1
sheet[count_row,1] = stu.user.show_real_name
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
if home.anonymous_comment ==0
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,11] = format_time(stu.commit_time)
else
sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,9] = format_time(stu.commit_time)
end
count_row += 1
end
end
homeworks.where(:homework_type => 3).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.name
sheet[2,0] = "教师团队"
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"
sheet[3,1] = "#{i+1}"
sheet[3,0] = "作业名称"
sheet[3,1] = home.name
if home.anonymous_comment ==0
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),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(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),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 = 5
items = home.score_student_works
items.each_with_index do |stu, j|
sheet[count_row,0] = j + 1
sheet[count_row,1] = stu.user.show_real_name
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = get_group_member_names home.student_works.where(:group_id => stu.group_id).pluck(:user_id)
sheet[count_row,5] = strip_html stu.description
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
if home.anonymous_comment ==0
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,12] = format_time(stu.commit_time)
else
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,10] = format_time(stu.commit_time)
end
count_row += 1
end
end
exercises.each_with_index do |exercise, i|
sheet = book.create_worksheet :name => "试卷第#{i+1}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[3,0] = "教师团队"
sheet[3,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "试卷批次"
sheet[3,1] = "#{i+1}"
sheet[3,0] = "试卷名称"
sheet[3,1] = exercise.exercise_name
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_objective_score),l(:excel_subjective_score),l(:excel_f_score),l(:excel_answer_time)])
count_row = 5
items = exercise.score_exercise_users
items.each_with_index do |stu, j|
sheet[count_row,0] = j + 1
sheet[count_row,1] = stu.user.show_real_name
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = stu.objective_score == -1 ? "0.0" : format("%.1f",stu.objective_score)
sheet[count_row,5] = stu.subjective_score == -1 ? "0.0" : format("%.1f",stu.subjective_score)
sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(1)
sheet[count_row,7] = stu.commit_status == 0 ? l(:excel_no_answer) : format_time(stu.start_at)
count_row += 1
end
end
tasks.each_with_index do |task, i|
sheet = book.create_worksheet :name => "毕设任务第#{i+1}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[2,0] = "教师团队"
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"
sheet[3,1] = "#{i+1}"
sheet[3,0] = "作业名称"
sheet[3,1] = task.name
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id)])
if task.task_type == 2
sheet.row(4).concat([l(:excel_group_member)])
end
sheet.row(4).concat([l(:excel_homework_des), l(:excel_t_score)])
if task.cross_comment
sheet.row(4).concat(["交叉评分"])
end
sheet.row(4).concat([l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
count_row = 5
items = task.graduation_works.where("work_status != 0").order("work_score desc")
items.each_with_index do |stu, j|
column = 0
sheet[count_row,column]= j + 1
sheet[count_row,column+=1] = stu.user.show_real_name
sheet[count_row,column+=1] = stu.user.login
sheet[count_row,column+=1] = stu.user.user_extensions.student_id
if task.task_type == 2
sheet[count_row,column+=1] = get_group_member_names task.graduation_works.where(:group_id => stu.group_id).pluck(:user_id)
end
sheet[count_row,column+=1] = strip_html stu.description
sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
if task.cross_comment
sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(1)
end
sheet[count_row,column+=1] = stu.late_penalty
sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,column+=1] = format_time(stu.commit_time)
count_row += 1
end
=begin
if task.task_type == 1
if task.cross_comment
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
else
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
end
else
if task.cross_comment
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
else
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
end
count_row = 5
items = task.graduation_works.order("work_score desc")
items.each_with_index do |stu, j|
column = 0
sheet[count_row,column]= j + 1
sheet[count_row,column+1] = stu.user.show_name
sheet[count_row,column+1] = stu.user.login
sheet[count_row,column+1] = stu.user.user_extensions.student_id
sheet[count_row,column+1] = strip_html stu.description
sheet[count_row,column+1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
if task.cross_comment
sheet[count_row,column+1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(2)
end
sheet[count_row,column+1] = stu.late_penalty
sheet[count_row,column+1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,column+1] = format_time(stu.commit_time)
count_row += 1
end
end
=end
end
# homeworks.where(:homework_type => 4).each_with_index do |home, i|
# sheet = book.create_worksheet :name => "#{home.name}"
# sheet[0,0] = "课程编号"
# sheet[0,1] = course.id
# sheet[1,0] = "课程名称"
# sheet[1,1] = course.name
# sheet[2,0] = "教师团队"
# sheet[2,1] = teacher_co
# sheet[3,0] = "主讲教师"
# sheet[3,1] = course.teacher.show_real_name
# sheet[3,0] = "作业批次"
# sheet[3,1] = "第#{i+1}次"
# sheet[3,0] = "作业名称"
# sheet[3,1] = home.name
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
# count_row = 5
# items = home.score_student_works
# # if items.count == 0 && home.publish_time < Time.now && !course.is_end
# # update_shixun_work_status home
# # items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
# # end
# items.each_with_index do |stu, j|
# sheet[count_row,0]= j + 1
# sheet[count_row,1] = stu.user.show_real_name
# sheet[count_row,2] = stu.user.login
# sheet[count_row,3] = stu.user.user_extensions.student_id
# sheet[count_row,4] = strip_html stu.description
# sheet[count_row,5] = stu.late_penalty
# sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
# sheet[count_row,7] = format_time(stu.commit_time)
# count_row += 1
# end
# end
#
# homeworks.where(:homework_type => 1).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.name
# sheet[2,0] = "教师团队"
# sheet[2,1] = teacher_co
# sheet[3,0] = "主讲教师"
# sheet[3,1] = course.teacher.show_real_name
# sheet[3,0] = "作业批次"
# sheet[3,1] = "第#{i+1}次"
# sheet[3,0] = "作业名称"
# sheet[3,1] = home.name
# if home.anonymous_comment ==0
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),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(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),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 = 5
# items = home.score_student_works
# items.each_with_index do |stu, j|
# sheet[count_row,0]= j + 1
# sheet[count_row,1] = stu.user.show_real_name
# sheet[count_row,2] = stu.user.login
# sheet[count_row,3] = stu.user.user_extensions.student_id
# sheet[count_row,4] = strip_html stu.description
# sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
# sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
# if home.anonymous_comment ==0
# sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
# sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
# sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
# sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
# sheet[count_row,11] = format_time(stu.commit_time)
# else
# sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
# sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
# sheet[count_row,9] = format_time(stu.commit_time)
# end
# count_row += 1
# end
#
# end
#
# homeworks.where(:homework_type => 3).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.name
# sheet[2,0] = "教师团队"
# sheet[2,1] = teacher_co
# sheet[3,0] = "主讲教师"
# sheet[3,1] = course.teacher.show_real_name
# sheet[3,0] = "作业批次"
# sheet[3,1] = "第#{i+1}次"
# sheet[3,0] = "作业名称"
# sheet[3,1] = home.name
#
# if home.anonymous_comment ==0
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),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(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),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 = 5
# items = home.score_student_works
# items.each_with_index do |stu, j|
# sheet[count_row,0] = j + 1
# sheet[count_row,1] = stu.user.show_real_name
# sheet[count_row,2] = stu.user.login
# sheet[count_row,3] = stu.user.user_extensions.student_id
# sheet[count_row,4] = get_group_member_names home.student_works.where(:group_id => stu.group_id).pluck(:user_id)
# sheet[count_row,5] = strip_html stu.description
# sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
# sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
# if home.anonymous_comment ==0
# sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
# sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
# sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
# sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
# sheet[count_row,12] = format_time(stu.commit_time)
# else
# sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
# sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
# sheet[count_row,10] = format_time(stu.commit_time)
# end
# count_row += 1
# end
# end
#
# exercises.each_with_index do |exercise, i|
# sheet = book.create_worksheet :name => "试卷第#{i+1}次"
# sheet[0,0] = "课程编号"
# sheet[0,1] = course.id
# sheet[1,0] = "课程名称"
# sheet[1,1] = course.name
# sheet[3,0] = "教师团队"
# sheet[3,1] = teacher_co
# sheet[3,0] = "主讲教师"
# sheet[3,1] = course.teacher.show_real_name
# sheet[3,0] = "试卷批次"
# sheet[3,1] = "第#{i+1}次"
# sheet[3,0] = "试卷名称"
# sheet[3,1] = exercise.exercise_name
#
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_objective_score),l(:excel_subjective_score),l(:excel_f_score),l(:excel_answer_time)])
# count_row = 5
# items = exercise.score_exercise_users
# items.each_with_index do |stu, j|
# sheet[count_row,0] = j + 1
# sheet[count_row,1] = stu.user.show_real_name
# sheet[count_row,2] = stu.user.login
# sheet[count_row,3] = stu.user.user_extensions.student_id
# sheet[count_row,4] = stu.objective_score == -1 ? "0.0" : format("%.1f",stu.objective_score)
# sheet[count_row,5] = stu.subjective_score == -1 ? "0.0" : format("%.1f",stu.subjective_score)
# sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(1)
# sheet[count_row,7] = stu.commit_status == 0 ? l(:excel_no_answer) : format_time(stu.start_at)
# count_row += 1
# end
# end
#
# tasks.each_with_index do |task, i|
# sheet = book.create_worksheet :name => "毕设任务第#{i+1}次"
# sheet[0,0] = "课程编号"
# sheet[0,1] = course.id
# sheet[1,0] = "课程名称"
# sheet[1,1] = course.name
# sheet[2,0] = "教师团队"
# sheet[2,1] = teacher_co
# sheet[3,0] = "主讲教师"
# sheet[3,1] = course.teacher.show_real_name
# sheet[3,0] = "作业批次"
# sheet[3,1] = "第#{i+1}次"
# sheet[3,0] = "作业名称"
# sheet[3,1] = task.name
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id)])
# if task.task_type == 2
# sheet.row(4).concat([l(:excel_group_member)])
# end
# sheet.row(4).concat([l(:excel_homework_des), l(:excel_t_score)])
# if task.cross_comment
# sheet.row(4).concat(["交叉评分"])
# end
# sheet.row(4).concat([l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
# count_row = 5
# items = task.graduation_works.where("work_status != 0").order("work_score desc")
# items.each_with_index do |stu, j|
# column = 0
# sheet[count_row,column]= j + 1
# sheet[count_row,column+=1] = stu.user.show_real_name
# sheet[count_row,column+=1] = stu.user.login
# sheet[count_row,column+=1] = stu.user.user_extensions.student_id
# if task.task_type == 2
# sheet[count_row,column+=1] = get_group_member_names task.graduation_works.where(:group_id => stu.group_id).pluck(:user_id)
# end
# sheet[count_row,column+=1] = strip_html stu.description
# sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
# if task.cross_comment
# sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(1)
# end
# sheet[count_row,column+=1] = stu.late_penalty
# sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
# sheet[count_row,column+=1] = format_time(stu.commit_time)
# count_row += 1
# end
# =begin
# if task.task_type == 1
# if task.cross_comment
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
# l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
# else
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
# l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
# end
# else
# if task.cross_comment
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
# l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
# else
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
# l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
# end
# count_row = 5
# items = task.graduation_works.order("work_score desc")
# items.each_with_index do |stu, j|
# column = 0
# sheet[count_row,column]= j + 1
# sheet[count_row,column+1] = stu.user.show_name
# sheet[count_row,column+1] = stu.user.login
# sheet[count_row,column+1] = stu.user.user_extensions.student_id
# sheet[count_row,column+1] = strip_html stu.description
# sheet[count_row,column+1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
# if task.cross_comment
# sheet[count_row,column+1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(2)
# end
# sheet[count_row,column+1] = stu.late_penalty
# sheet[count_row,column+1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
# sheet[count_row,column+1] = format_time(stu.commit_time)
# count_row += 1
# end
# end
# =end
# end
book.write xls_report
xls_report.string

Loading…
Cancel
Save