From 9fc7ed8233457efcc0bc6c4a9fe5af6754041767 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 31 Dec 2014 16:00:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=80=81=E5=B8=88=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E8=AF=84=E5=88=86=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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!