From aef68fdc821e7e9d93660b4c4440d9c4eb8c761b Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Tue, 17 Dec 2013 01:06:20 -0700 Subject: [PATCH] ensure task.priority is number for apiv1 --- dist/habitrpg-shared.js | 3 +++ script/index.coffee | 1 + 2 files changed, 4 insertions(+) diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index 49a4b80213..8d771891d4 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -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; }; diff --git a/script/index.coffee b/script/index.coffee index cd371aeeff..e448a5eaf6 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -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) ->