|
|
|
@ -335,6 +335,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
begin
|
|
|
|
|
# 没传score则取上次评分成绩
|
|
|
|
|
new_score = StudentWorksScore.new
|
|
|
|
|
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.comment = params[:comment] if params[:comment] && params[:comment].strip != ""
|
|
|
|
|
new_score.user_id = current_user.id
|
|
|
|
@ -349,7 +350,6 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
reviewer_role = @user_course_identity == Course::STUDENT ? 3 : @user_course_identity == Course::ASSISTANT_PROFESSOR ? 2 : 1
|
|
|
|
|
new_score.reviewer_role = reviewer_role
|
|
|
|
|
score = StudentWorksScore.where(user_id: current_user.id, student_work_id: @work.id, reviewer_role: reviewer_role).last
|
|
|
|
|
|
|
|
|
|
if new_score.save!
|
|
|
|
|
Attachment.associate_container(params[:attachment_ids], new_score.id, new_score.class)
|
|
|
|
|