From 8baa4cd8db65585dc20554f73e5ab95b6bc22401 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Mon, 4 Feb 2013 02:51:59 -0500 Subject: [PATCH] dailies not resetting on cron --- src/app/scoring.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/scoring.coffee b/src/app/scoring.coffee index a1fc5129d2..05ebdb2f6f 100644 --- a/src/app/scoring.coffee +++ b/src/app/scoring.coffee @@ -151,11 +151,6 @@ score = (taskId, direction, times, batch, cron) -> calculateDelta() if cron? # cron subtractPoints() - taskObj.history ?= [] - taskObj.history.push { date: +new Date, value: value } - taskObj.completed = false - batch.set "#{taskPath}.history", taskObj.history - batch.set "#{taskPath}.completed", false else addPoints() # obviously for delta>0, but also a trick to undo accidental checkboxes @@ -225,7 +220,12 @@ cron = (resetDom_cb) -> daysFailed++ score id, 'down', daysFailed, batch, true - if type == 'todo' + if type == 'daily' + taskObj.history ?= [] + taskObj.history.push { date: +new Date, value: value } + batch.set "tasks.#{taskObj.id}.history", taskObj.history + batch.set "tasks.#{taskObj.id}.completed", false + else value = obj.tasks[taskObj.id].value #get updated value absVal = if (completed) then Math.abs(value) else value todoTally += absVal