Proper reward processing & updating user-stats on vote save
This commit is contained in:
@@ -15,8 +15,11 @@ class HabitTracker.Models.User extends Backbone.Model
|
||||
@set({ lvl: @get('lvl') + 1 })
|
||||
|
||||
# also add money. Only take away money if it was a mistake (aka, a checkbox)
|
||||
if delta>0 or !habit.isHabit()
|
||||
if delta>0 or (habit.isDaily() or habit.isTodo())
|
||||
@set({money: @get('money')+delta})
|
||||
# if buying an item, deduct cost
|
||||
if habit.isReward()
|
||||
@set({money: @get('money')-habit.get('score')})
|
||||
|
||||
@trigger('updatedStats')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user