mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-31 23:11:15 +00:00
apiv2: fix transform form user.tasks => user.habits/dailies/etc,
maintain sort order
This commit is contained in:
parent
b50a78f0ea
commit
746153f417
1 changed files with 1 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ router.post '/', api.auth, (req, res, next) ->
|
|||
uObj = misc.hydrate user.get()
|
||||
#transform user structure FROM user.tasks{} + user.habitIds[] TO user.habits[] + user.todos[] etc.
|
||||
_.each ['habit','daily','todo','reward'], (type) ->
|
||||
uObj["#{type}s"] = _.where(uObj.tasks, {type}); true
|
||||
uObj["#{type}s"] = _.transform uObj["#{type}Ids"], (result, tid) -> uObj.tasks[tid]
|
||||
delete uObj["#{type}Ids"]
|
||||
delete uObj.tasks
|
||||
res.json 200, uObj
|
||||
|
|
|
|||
Loading…
Reference in a new issue