ensure task.priority is number for apiv1

This commit is contained in:
Tyler Renelle 2013-12-17 01:06:20 -07:00
parent d3e3775ecd
commit aef68fdc82
2 changed files with 4 additions and 0 deletions

View file

@ -10788,6 +10788,9 @@ var process=require("__browserify_process");(function() {
if (task.value == null) {
task.value = task.type === 'reward' ? 10 : 0;
}
if (!_.isNumber(task.priority)) {
task.priority = 1;
}
return task;
};

View file

@ -171,6 +171,7 @@ api.taskDefaults = (task) ->
_.defaults(task, {streak:0, repeat: {su:1,m:1,t:1,w:1,th:1,f:1,s:1}}) if task.type is 'daily'
task._id = task.id # may need this for TaskSchema if we go back to using it, see http://goo.gl/a5irq4
task.value ?= if task.type is 'reward' then 10 else 0
task.priority = 1 unless _.isNumber(task.priority) # hotfix for apiv1. once we're off apiv1, we can remove this
task
api.percent = (x,y) ->