mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
back to transction for corruptTasks
This commit is contained in:
parent
0680822c19
commit
8ed72ae2aa
1 changed files with 6 additions and 1 deletions
|
|
@ -34,6 +34,9 @@ cleanupCorruptTasks = (model) ->
|
|||
user.del("tasks.#{key}")
|
||||
delete tasks[key]
|
||||
|
||||
batch = new require('./character').BatchUpdate(model)
|
||||
batch.startTransaction()
|
||||
|
||||
## Task List Cleanup
|
||||
_.each ['habit','daily','todo','reward'], (type) ->
|
||||
|
||||
|
|
@ -49,9 +52,11 @@ cleanupCorruptTasks = (model) ->
|
|||
# There were indeed issues found, set the new list
|
||||
wasCorrupted = !_.isEmpty _.difference(idList, preened)
|
||||
if wasCorrupted
|
||||
user.set("#{type}Ids", preened)
|
||||
batch.set("#{type}Ids", preened)
|
||||
console.error user.get('id') + "'s #{type}s were corrupt."
|
||||
|
||||
batch.commit()
|
||||
|
||||
get '/', (page, model, params, next) ->
|
||||
return page.redirect '/' if page.params?.query?.play?
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue