修改竞赛模块,重复评分不会以最后一次评分为准的BUG

This commit is contained in:
sw 2014-12-29 16:03:51 +08:00
parent aa06251fd3
commit 8dc9b223b1
1 changed files with 3 additions and 3 deletions

View File

@ -37,9 +37,9 @@ module SeemsRateable
def update_users_rating(stars, user_id, dimension=nil)
obj = rates(dimension).where(:rater_id => user_id).first
#current_record = average(dimension)
#current_record.avg = (current_record.avg*current_record.cnt - obj.stars + stars) / (current_record.cnt)
#current_record.save!
current_record = average(dimension)
current_record.avg = (current_record.avg*current_record.cnt - obj.stars + stars) / (current_record.cnt)
current_record.save!
obj.stars = stars
obj.save!
end