修复老师第一次评分报错问题的BUG

This commit is contained in:
sw 2014-12-31 16:00:45 +08:00
parent 16201f79cf
commit 9fc7ed8233
1 changed files with 2 additions and 2 deletions

View File

@ -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!