mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
apiv2 fix on adding cron to queue
This commit is contained in:
parent
e7d200f1b0
commit
4857e44f79
1 changed files with 4 additions and 6 deletions
|
|
@ -80,12 +80,10 @@ router.post '/', api.auth, (req, res, next) ->
|
||||||
cb()
|
cb()
|
||||||
|
|
||||||
# Setup the array of functions we're going to call in parallel with async
|
# Setup the array of functions we're going to call in parallel with async
|
||||||
req.body = [] if _.isEmpty req.body
|
# Start with cron
|
||||||
actions = _.transform (req.body or []), (result, action) ->
|
(req.body or= []).unshift({op: 'cron'})
|
||||||
unless _.isEmpty(action)
|
actions = _.transform (req.body), (result, action) ->
|
||||||
result.push (cb) -> performAction(action, cb)
|
result.push (cb) -> performAction(action, cb) unless _.isEmpty(action)
|
||||||
# always run cron check
|
|
||||||
req.body.unshift({op: 'cron'}) unless _.isEmpty actions
|
|
||||||
|
|
||||||
# call all the operations, then return the user object to the requester
|
# call all the operations, then return the user object to the requester
|
||||||
async.series actions, (err) ->
|
async.series actions, (err) ->
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue