作业导出成绩增加评语的导出

dev_library
cxt 6 years ago
parent f5405ec534
commit fbda6b378d

@ -2017,10 +2017,10 @@ class StudentWorkController < ApplicationController
if @homework.homework_type == 1 #普通作业
if @homework.anonymous_comment ==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_course_group),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_update_time)])
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_update_time), "评语"])
else
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_course_group),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
end
count_row = 1
items.each do |homework|
@ -2039,10 +2039,12 @@ class StudentWorkController < ApplicationController
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,12] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,13] = format_time(homework.update_time)
sheet1[count_row,14] = work_comment(homework)
else
sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,10] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,11] = format_time(homework.update_time)
sheet1[count_row,12] = work_comment(homework)
end
count_row += 1
end
@ -2082,10 +2084,10 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_type == 3 #分组作业
if @homework.anonymous_comment ==0
sheet1.row(0).concat([l(:excel_group),l(:excel_group_member),l(:excel_course_group),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_update_time)])
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_update_time), "评语"])
else
sheet1.row(0).concat([l(:excel_group),l(:excel_group_member),l(:excel_course_group),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
end
count_row = 1
items.each do |homework|
@ -2101,16 +2103,18 @@ class StudentWorkController < ApplicationController
sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,9] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.update_time)
sheet1[count_row,11] = work_comment(homework)
else
sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,7] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,8] = format_time(homework.update_time)
sheet1[count_row,9] = work_comment(homework)
end
count_row += 1
end
elsif @homework.homework_type == 4 #实训作业
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_course_group),l(:excel_homework_complete_time),
l(:excel_homework_complete_status), l(:excel_homework_evaluate_times), l(:excel_homework_spend_time),l(:excel_homework_total_exp),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_homework_complete_status), l(:excel_homework_evaluate_times), l(:excel_homework_spend_time),l(:excel_homework_total_exp),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
count_row = 1
shixun = @homework.homework_commons_shixuns.shixun
items.each do |homework|
@ -2129,6 +2133,7 @@ class StudentWorkController < ApplicationController
sheet1[count_row,11] = homework.late_penalty
sheet1[count_row,12] = homework.respond_to?("work_score") ? homework.work_score.nil? ? "--" : homework.work_score.round(1) : "--"
sheet1[count_row,13] = homework.update_time ? format_time(homework.update_time) : "--"
sheet1[count_row,14] = work_comment(homework)
count_row += 1
end

@ -3,6 +3,17 @@ include UserScoreHelper
module StudentWorkHelper
# 作品的评语(拼接导出excel成绩)
def work_comment work
comment = ""
work_scores = work.student_works_scores.order("created_at desc")
work_scores.each do |score|
comment += "#{score.user.show_real_name} #{format_time(score.created_at)} #{score.score}\n"
comment += "#{score.comment}\n\n"
end
comment
end
#获取当前用户的项目列表
def user_projects_option
projects = User.current.projects.visible

Loading…
Cancel
Save