整组同评

dev_course
cxt 5 years ago
parent 8828a04432
commit b70179d967

@ -730,19 +730,19 @@ class StudentWorksController < ApplicationController
student_works.each do |st_work| student_works.each do |st_work|
st_score = StudentWorksScore.new(user_id: new_score.user_id, score: new_score.score, st_score = StudentWorksScore.new(user_id: new_score.user_id, score: new_score.score,
reviewer_role: new_score.reviewer_role, comment: new_score.comment) reviewer_role: new_score.reviewer_role, comment: new_score.comment)
st_work.student_works_scores << st_score
score = StudentWorksScore.where(user_id: new_score.user_id, student_work_id: st_work.id).last score = StudentWorksScore.where(user_id: new_score.user_id, student_work_id: st_work.id, reviewer_role: new_score.reviewer_role).last
# 该用户的历史评阅无效 # 该用户的历史评阅无效
score.update_column('is_invalid', true) if score.present? && score.score.present? score.update_column('is_invalid', true) if score.present? && score.score.present?
st_work.student_works_scores << st_score
if new_score.reviewer_role == 1 if new_score.reviewer_role == 1
st_work.teacher_score = new_score.score st_work.teacher_score = new_score.score if new_score.score.present?
elsif new_score.reviewer_role == 2 elsif new_score.reviewer_role == 2
if homework.homework_detail_manual.ta_mode == 1 if homework.homework_detail_manual.ta_mode == 1
st_work.teaching_asistant_score = new_score.ta_score st_work.id st_work.teaching_asistant_score = new_score.ta_score st_work.id if new_score.score.present?
else else
st_work.teaching_asistant_score = new_score.score st_work.teaching_asistant_score = new_score.score if new_score.score.present?
end end
else else
st_work.student_score = student_work.student_score st_work.student_score = student_work.student_score

Loading…
Cancel
Save