|
|
|
@ -334,7 +334,6 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
# 没传score则取上次评分成绩
|
|
|
|
|
score = StudentWorksScore.where(user_id: current_user.id, student_work_id: @work.id).last
|
|
|
|
|
new_score = StudentWorksScore.new
|
|
|
|
|
new_score.score = params[:score].blank? ? score.try(:score) : params[:score].to_f
|
|
|
|
|
new_score.comment = params[:comment] if params[:comment] && params[:comment].strip != ""
|
|
|
|
@ -348,7 +347,9 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
@work.update_attributes(group_id: @homework.max_group_id) if @homework.homework_type == "group"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
new_score.reviewer_role = @user_course_identity == Course::STUDENT ? 3 : @user_course_identity == Course::ASSISTANT_PROFESSOR ? 2 : 1
|
|
|
|
|
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)
|
|
|
|
@ -740,7 +741,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
st_work.teacher_score = new_score.score if new_score.score.present?
|
|
|
|
|
elsif new_score.reviewer_role == 2
|
|
|
|
|
if homework.homework_detail_manual.ta_mode == 1
|
|
|
|
|
st_work.teaching_asistant_score = new_score.ta_score st_work.id if new_score.score.present?
|
|
|
|
|
st_work.teaching_asistant_score = new_score.ta_score st_work.id
|
|
|
|
|
else
|
|
|
|
|
st_work.teaching_asistant_score = new_score.score if new_score.score.present?
|
|
|
|
|
end
|
|
|
|
|