Merge pull request #101 from HabitRPG/sabe/fix2

fix(checklists): Make checklist To-Do behavior more intuitive
This commit is contained in:
Tyler Renelle 2014-01-19 15:16:04 -08:00
commit 21ea62b918
2 changed files with 7 additions and 5 deletions

View file

@ -12041,8 +12041,10 @@ var process=require("__browserify_process");(function() {
return m + (i.completed ? 1 : 0);
}), 0) / task.checklist.length;
}
if (task.type === 'todo') {
nextDelta *= task.checklist.length;
if (task.type === 'todo' && direction === 'up') {
nextDelta *= 1 + _.reduce(task.checklist, (function(m, i) {
return m + (i.completed ? 1 : 0);
}), 0);
}
}
if (task.type !== 'reward') {

View file

@ -755,9 +755,9 @@ api.wrap = (user, main=true) ->
# 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 task.type is 'todo'
nextDelta *= task.checklist.length
# If To-Do, point-match the TD per checklist item completed
if task.type is 'todo' and direction is 'up'
nextDelta *= (1 + _.reduce(task.checklist,((m,i)->m+(if i.completed then 1 else 0)),0))
unless task.type is 'reward'
if (user.preferences.automaticAllocation is true and user.preferences.allocationMode is 'taskbased') then user.stats.training[task.attribute] += nextDelta