导出的作品成绩保存为数字格式

This commit is contained in:
cxt 2016-05-11 14:51:49 +08:00
parent 77d713a390
commit d4a35b94f6
1 changed files with 9 additions and 9 deletions

View File

@ -1158,10 +1158,10 @@ class StudentWorkController < ApplicationController
sheet1[count_row,4] = homework.user.mail
sheet1[count_row,5] = homework.name
sheet1[count_row,6] = strip_html homework.description
sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_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,7] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,11] = format_time(homework.created_at)
count_row += 1
end
@ -1177,11 +1177,11 @@ class StudentWorkController < ApplicationController
sheet1[count_row,4] = homework.user.mail
sheet1[count_row,5] = homework.name
sheet1[count_row,6] = homework.description
sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score)
sheet1[count_row,9] = homework.system_score.nil? ? l(:label_without_score) : format("%.2f",homework.system_score)
sheet1[count_row,10] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)
sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score)
sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : homework.teacher_score.round(2)
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
sheet1[count_row,9] = homework.system_score.nil? ? l(:label_without_score) : homework.system_score.round(2)
sheet1[count_row,10] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,12] = format_time(homework.created_at)
count_row += 1
end