实训导出成绩增加评语

dev_auth
cxt 5 years ago
parent 4d0ef08785
commit 29eb9de257

@ -112,7 +112,7 @@ module ExportHelper
@work_cells_column.push(row_cells_column) @work_cells_column.push(row_cells_column)
end end
else #实训题 else #实训题
shixun = homework.shixuns.first shixun = homework.shixuns.take
shixun_head_cells = %w(完成情况 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分) shixun_head_cells = %w(完成情况 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
eff_boolean = homework.work_efficiency eff_boolean = homework.work_efficiency
if eff_boolean if eff_boolean
@ -123,7 +123,10 @@ module ExportHelper
if allow_late_boolean #允许迟交 if allow_late_boolean #允许迟交
eff_score_cell.push("迟交扣分") eff_score_cell.push("迟交扣分")
end end
shixun_time_cells = %w(最终成绩 更新时间 作业发布到学员完成作业所耗的时间 评语) shixun_time_cells = %w(最终成绩 更新时间 作业发布到学员完成作业所耗的时间 总评语)
for i in 1 .. shixun.challenges.size
shixun_time_cells << "#{i}关评语"
end
@work_head_cells = (head_cells_format + shixun_head_cells + eff_score_cell + shixun_time_cells).reject(&:blank?) @work_head_cells = (head_cells_format + shixun_head_cells + eff_score_cell + shixun_time_cells).reject(&:blank?)
works.includes(:student_works_scores, user: :user_extension, myshixun: :games).each_with_index do |w, index| works.includes(:student_works_scores, user: :user_extension, myshixun: :games).each_with_index do |w, index|
myshixun = w.try(:myshixun) myshixun = w.try(:myshixun)
@ -165,21 +168,20 @@ module ExportHelper
w_16 = w.update_time ? format_time(w.update_time) : "--" "更新时间" w_16 = w.update_time ? format_time(w.update_time) : "--" "更新时间"
myshixun_complete = myshixun && myshixun.status == 1 myshixun_complete = myshixun && myshixun.status == 1
w_17 = myshixun_complete && w.cost_time ? (game_spend_time w.cost_time) : "未完成" w_17 = myshixun_complete && w.cost_time ? (game_spend_time w.cost_time) : "未完成"
teacher_comments = w.student_works_scores teacher_comment = w.shixun_work_comments.find_by(challenge_id: 0)
if teacher_comments.present? if teacher_comment.present?
w_18 = "" w_18 = "学生可见:\n #{teacher_comment.comment.to_s} \n\n 老师可见:\n#{teacher_comment.hidden_comment.to_s}"
teacher_comments.each do |t|
user_name = t.user&.real_name
user_time = format_time(t.updated_at)
user_score = t&.score
user_comment = t.comment.present? ? t.comment : "--"
comment_title = "#{user_name} #{user_time.to_s} #{user_score.to_s}\n#{user_comment}\n\n"
w_18 = w_18 + comment_title
end
else else
w_18 = "--" w_18 = "--"
end end
row_cells_column = [w_1,w_2,w_3,w_3_1,w_4,w_5,w_6,w_7,w_8,w_9,w_10,w_11,w_12,w_13,w_14,w_15,w_16,w_17,w_18] row_cells_column = [w_1,w_2,w_3,w_3_1,w_4,w_5,w_6,w_7,w_8,w_9,w_10,w_11,w_12,w_13,w_14,w_15,w_16,w_17,w_18]
# 关卡评语
shixun.challenges.pluck(:challenge_id) do |challenge_id|
challenge_comment = w.shixun_work_comments.find_by(challenge_id: challenge_id)
row_cells_column << "学生可见:\n #{challenge_comment.comment.to_s} \n\n 老师可见:\n#{challenge_comment.hidden_comment.to_s}"
end
row_cells_column = row_cells_column.reject(&:blank?) row_cells_column = row_cells_column.reject(&:blank?)
@work_cells_column.push(row_cells_column) @work_cells_column.push(row_cells_column)
end end

Loading…
Cancel
Save