mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Fixed purchased items and such in the user so that they're strings instead of ObjectIds.
This commit is contained in:
parent
b751f5ab22
commit
8edde2f470
1 changed files with 3 additions and 3 deletions
|
@ -32,7 +32,7 @@ PurchaseHandler = class PurchaseHandler extends Handler
|
|||
return @sendBadInputError(res) if not collection in @jsonSchema.properties.purchased.properties.collection.enum
|
||||
|
||||
handler = require('../' + handlers[collection])
|
||||
criteria = { 'original': mongoose.Types.ObjectId(purchasedOriginal) }
|
||||
criteria = { 'original': purchasedOriginal }
|
||||
sort = { 'version.major': -1, 'version.minor': -1 }
|
||||
|
||||
handler.modelClass.findOne(criteria).sort(sort).exec (err, purchasedItem) =>
|
||||
|
@ -44,7 +44,7 @@ PurchaseHandler = class PurchaseHandler extends Handler
|
|||
req.purchasedItem = purchasedItem # for safekeeping
|
||||
|
||||
criteria = {
|
||||
'purchased.original': purchased?.original
|
||||
'purchased.original': purchasedOriginal
|
||||
'recipient': purchaser
|
||||
}
|
||||
Purchase.findOne criteria, (err, purchase) =>
|
||||
|
@ -73,7 +73,7 @@ PurchaseHandler = class PurchaseHandler extends Handler
|
|||
purchased[group] ?= []
|
||||
unless original in purchased[group]
|
||||
#- add the purchase to the list of purchases
|
||||
purchased[group].push(original)
|
||||
purchased[group].push(original+'')
|
||||
user.set('purchased', purchased)
|
||||
|
||||
#- deduct the gems from the user
|
||||
|
|
Loading…
Reference in a new issue