diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index f4ce2e2af..68b3af5a4 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -439,8 +439,8 @@ class HomeworkAttachController < ApplicationController homework = @homework is_teacher = @is_teacher ? 1 : 0 #保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0)) - rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first - if @m_score && rate.stars != @m_score + if @m_score + rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first if rate rate.stars = @m_score rate.save!