checklists: point-match TDs for each CL-item. Bug fix on resetting CLs
on cron
This commit is contained in:
+9
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user