调分调整

dev_course
cxt 5 years ago
parent 7710ee6e08
commit a83b4f1327

@ -334,6 +334,7 @@ class StudentWorksController < ApplicationController
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
# 没传score则取上次评分成绩 # 没传score则取上次评分成绩
reviewer_role = @user_course_identity == Course::STUDENT ? 3 : @user_course_identity == Course::ASSISTANT_PROFESSOR ? 2 : 1
new_score = StudentWorksScore.new new_score = StudentWorksScore.new
score = StudentWorksScore.where(user_id: current_user.id, student_work_id: @work.id, reviewer_role: reviewer_role).last score = StudentWorksScore.where(user_id: current_user.id, student_work_id: @work.id, reviewer_role: reviewer_role).last
new_score.score = params[:score].blank? ? score.try(:score) : params[:score].to_f new_score.score = params[:score].blank? ? score.try(:score) : params[:score].to_f
@ -348,7 +349,6 @@ class StudentWorksController < ApplicationController
@work.update_attributes(group_id: @homework.max_group_id) if @homework.homework_type == "group" @work.update_attributes(group_id: @homework.max_group_id) if @homework.homework_type == "group"
end end
reviewer_role = @user_course_identity == Course::STUDENT ? 3 : @user_course_identity == Course::ASSISTANT_PROFESSOR ? 2 : 1
new_score.reviewer_role = reviewer_role new_score.reviewer_role = reviewer_role
if new_score.save! if new_score.save!

Loading…
Cancel
Save