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

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

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

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