notifications tweak and history fix

This commit is contained in:
Philip How 2013-03-08 00:10:11 +00:00
parent 1fadb7955a
commit 50c5069224
2 changed files with 3 additions and 3 deletions

View file

@ -178,7 +178,7 @@ setupGrowlNotifications = (model) ->
# unless silent
num = captures - args
rounded = Math.abs(num.toFixed(1))
if num < 0 and num > -100 # TODO fix hackey negative notification supress
if num < 0 and num > -50 # TODO fix hackey negative notification supress
statsNotification "<i class='icon-star'></i> - #{rounded} XP", 'xp'
else if num > 0
statsNotification "<i class='icon-star'></i> + #{rounded} XP", 'xp'

View file

@ -220,7 +220,7 @@ cron = (model) ->
batch.set "tasks.#{taskObj.id}.value", newValue
taskObj.history ?= []
taskObj.history.push { date: +new Date, value: value }
taskObj.history.push { date: +new Date, value: newValue || taskObj.value }
batch.set "tasks.#{taskObj.id}.history", taskObj.history
batch.set "tasks.#{taskObj.id}.completed", false
else
@ -229,7 +229,7 @@ cron = (model) ->
todoTally += absVal
else if type is 'habit' # slowly reset 'onlies' value to 0
if taskObj.up==false or taskObj.down==false
if Math.abs(taskObj.value) < 0.02
if Math.abs(taskObj.value) < 0.1
batch.set "tasks.#{taskObj.id}.value", 0
else
batch.set "tasks.#{taskObj.id}.value", taskObj.value / 2