|
|
|
@ -415,25 +415,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
sheet1 = book.create_worksheet :name => "homework"
|
|
|
|
|
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
|
|
|
|
sheet1.row(0).default_format = blue
|
|
|
|
|
if @homework.homework_type == 0 #普通作业
|
|
|
|
|
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
count_row = 1
|
|
|
|
|
items.each do |homework|
|
|
|
|
|
sheet1[count_row,0]=homework.user.id
|
|
|
|
|
sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s
|
|
|
|
|
sheet1[count_row,2] = homework.user.login
|
|
|
|
|
sheet1[count_row,3] = homework.user.user_extensions.student_id
|
|
|
|
|
sheet1[count_row,4] = homework.user.mail
|
|
|
|
|
sheet1[count_row,5] = homework.name
|
|
|
|
|
sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
|
|
|
|
|
sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score)
|
|
|
|
|
# sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)
|
|
|
|
|
sheet1[count_row,8] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score)
|
|
|
|
|
sheet1[count_row,9] = format_time(homework.created_at)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
elsif @homework.homework_type == 1 #匿评作业
|
|
|
|
|
if @homework.homework_type == 1 #匿评作业
|
|
|
|
|
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
count_row = 1
|
|
|
|
@ -453,7 +435,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
elsif @homework.homework_type == 2 #编程作业
|
|
|
|
|
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
count_row = 1
|
|
|
|
|
items.each do |homework|
|
|
|
|
|
sheet1[count_row,0]=homework.user.id
|
|
|
|
@ -464,9 +446,10 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
sheet1[count_row,5] = homework.name
|
|
|
|
|
sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
|
|
|
|
|
sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score)
|
|
|
|
|
sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)
|
|
|
|
|
sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score)
|
|
|
|
|
sheet1[count_row,10] = format_time(homework.created_at)
|
|
|
|
|
sheet1[count_row,8] = homework.system_score.nil? ? l(:label_without_score) : format("%.2f",homework.system_score)
|
|
|
|
|
sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)
|
|
|
|
|
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score)
|
|
|
|
|
sheet1[count_row,11] = format_time(homework.created_at)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|