diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index acbb627985..a44dc420f0 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -11690,14 +11690,15 @@ var process=require("__browserify_process");(function() { var adjustAmt, currVal, nextDelta, _ref1, _ref2; currVal = task.value < -47.27 ? -47.27 : task.value > 21.27 ? 21.27 : task.value; nextDelta = Math.pow(0.9747, currVal) * (direction === 'down' ? -1 : 1); - if (direction === 'down' && task.type === 'daily' && options.cron && ((_ref1 = task.checklist) != null ? _ref1.length : void 0) > 0) { - nextDelta *= 1 - _.reduce(task.checklist, (function(m, i) { - return m + (i.completed ? 1 : 0); - }), 0) / task.checklist.length; - _.each(task.checklist, (function(i) { - i.completed = false; - return true; - })); + if (((_ref1 = task.checklist) != null ? _ref1.length : void 0) > 0) { + if (direction === 'down' && task.type === 'daily' && options.cron) { + nextDelta *= 1 - _.reduce(task.checklist, (function(m, i) { + return m + (i.completed ? 1 : 0); + }), 0) / task.checklist.length; + } + if (direction === 'up' && task.type === 'todo') { + nextDelta *= task.checklist.length; + } } if (task.type !== 'reward') { adjustAmt = nextDelta; @@ -12135,7 +12136,11 @@ var process=require("__browserify_process");(function() { date: +(new Date), value: task.value }); - return task.completed = false; + task.completed = false; + return _.each(task.checklist, (function(i) { + i.completed = false; + return true; + })); case 'todo': absVal = completed ? Math.abs(task.value) : task.value; return todoTally += absVal; diff --git a/script/index.coffee b/script/index.coffee index bbed240317..66603dfac5 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -688,10 +688,14 @@ api.wrap = (user) -> else task.value nextDelta = Math.pow(0.9747, currVal) * (if direction is 'down' then -1 else 1) - # If the Daily has a checklist, only dock them them a portion based on their checklist completion - if direction is 'down' and task.type is 'daily' and options.cron and task.checklist?.length > 0 - nextDelta *= (1 - _.reduce(task.checklist,((m,i)->m+(if i.completed then 1 else 0)),0) / task.checklist.length) - _.each task.checklist, ((i)->i.completed=false;true) + # Checklists + if task.checklist?.length > 0 + # If the Daily, only dock them them a portion based on their checklist completion + if direction is 'down' and task.type is 'daily' and options.cron + nextDelta *= (1 - _.reduce(task.checklist,((m,i)->m+(if i.completed then 1 else 0)),0) / task.checklist.length) + # If To-Do, point-match the TD per checklist item + if direction is 'up' and task.type is 'todo' + nextDelta *= task.checklist.length unless task.type is 'reward' adjustAmt = nextDelta @@ -1070,6 +1074,7 @@ api.wrap = (user) -> when 'daily' (task.history ?= []).push({ date: +new Date, value: task.value }) task.completed = false + _.each task.checklist, ((i)->i.completed=false;true) when 'todo' #get updated value absVal = if (completed) then Math.abs(task.value) else task.value