Deduct money if their checkbox was a mistake

This commit is contained in:
Tyler Renelle 2012-02-04 17:34:16 -05:00
parent 82a343fa71
commit 95e52378d9

View file

@ -30,8 +30,8 @@ class Habit < ActiveRecord::Base
self.score += value
# also add money (we never take away money)
if direction=='up'
# also add money. Only take away money if it was a mistake (aka, a checkbox)
if (direction=='up') || (direction=='down' && self.habit_type!=Habit::ALWAYS)
self.user.money += value
self.user.save
end