add potion & reroll to itemstore, add taskDefaults helper

This commit is contained in:
Tyler Renelle
2013-08-25 14:53:45 -04:00
parent bff1b50e42
commit 6a3b2fc1a1
4 changed files with 2178 additions and 2086 deletions
+16
View File
@@ -55,6 +55,22 @@ module.exports =
uuid: uuid
taskDefaults: (task, filters={}) ->
self = @
defaults =
id: self.uuid()
text: ''
up: true
down: true
type: 'habit'
completed: false
repeat: {su:true,m:true,t:true,w:true,th:true,f:true,s:true}
notes: ''
tags: _.transform(filters, (m,v,k) -> m[k]=v if v)
_.defaults task, defaults
task.value ?= if task.type is 'reward' then 10 else 0
task
newUser: (isDerby=false) ->
userSchema =
# _id / id handled by Racer
+3 -1
View File
@@ -109,7 +109,9 @@ module.exports.updateStore = (user) ->
else if i is items[type].length
showNext = false
changes[type] = if showNext then items[type][i] else {hide:true}
return changes
changes.potion = items.potion
changes.reroll = items.reroll
changes
###
Gets an itme, and caps max to the last item in its array