WIP: Improve User model performances (#10832)

* wip: define items as mixed objects

* add default owned gear

* mark modified

* more mark modified

* more mark modified

* more mark modified

* more mark modified

* fix common tests

* fix common tests

* update mongoose

* add itemsUtils

* use new util function in hall controller

* add tests for items utils

* update website/server to mark all items as modified

* start updating common code

* update login incentives

* update unlock

* remove changes to package-lock.json

* remove changes to package.json
This commit is contained in:
Matteo Pagliazzi
2019-04-01 19:24:18 +02:00
committed by GitHub
parent 95e541ae75
commit 0b8ce63c76
38 changed files with 304 additions and 42 deletions

View File

@@ -10,7 +10,7 @@ function equipmentStatBonusComputed (stat, user) {
let classBonus = 0;
// toObject is required here due to lodash values not working well with mongoose doc objects.
// if toObject doesn't exist, we're on the client side and can assume the object is already plain JSON
// if toObject doesn't exist, we can assume the object is already plain JSON
// see http://stackoverflow.com/questions/25767334/underscore-js-keys-and-omit-not-working-as-expected
let equipped = user.items.gear.equipped;
let equippedKeys = values(!equipped.toObject ? equipped : equipped.toObject());