mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-04 17:19:47 -04:00
Fixed an async case that failed a test only sometimes
This commit is contained in:
parent
9c0353a2f0
commit
8e82702348
1 changed files with 2 additions and 4 deletions
|
@ -258,16 +258,14 @@ module.exports.VersionedPlugin = (schema) ->
|
|||
)
|
||||
)
|
||||
|
||||
# Assume ever save is a new version, hence an edit
|
||||
# Assume every save is a new version, hence an edit
|
||||
schema.pre 'save', (next) ->
|
||||
User = require '../users/User' # Avoid mutual inclusion cycles
|
||||
userID = @get('creator')?.toHexString()
|
||||
return next() unless userID?
|
||||
|
||||
statName = User.statsMapping.edits[@constructor.modelName]
|
||||
User.incrementStat userID, statName
|
||||
|
||||
next()
|
||||
User.incrementStat userID, statName, next
|
||||
|
||||
module.exports.SearchablePlugin = (schema, options) ->
|
||||
# this plugin must be added only after the others (specifically Versioned and Permissions)
|
||||
|
|
Loading…
Add table
Reference in a new issue