mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Fixed i18n population because mongoose has problems with empty objects.
This commit is contained in:
parent
89dc724d31
commit
8cb7cd770c
2 changed files with 2 additions and 2 deletions
|
@ -237,7 +237,7 @@ class CocoModel extends Backbone.Model
|
|||
data ?= $.extend true, {}, @attributes
|
||||
schema ?= @schema() or {}
|
||||
if schema.properties?.i18n and _.isPlainObject(data) and not data.i18n?
|
||||
data.i18n = {}
|
||||
data.i18n = {'-':'-'} # mongoose doesn't work with empty objects
|
||||
sum += 1
|
||||
|
||||
if _.isPlainObject data
|
||||
|
|
|
@ -46,7 +46,7 @@ db.users.find({anonymous:false}, params).sort({_id:1}).forEach(function (user) {
|
|||
}
|
||||
update.slug = slug;
|
||||
slugs[slug] = user.name;
|
||||
if(user.slug) return;
|
||||
if(user.slug === slug) return;
|
||||
print(_.str.sprintf('Setting user %s (%s) to slug %s with update %s', user.name, user.dateCreated, slug, JSON.stringify({$set:update})));
|
||||
var res = db.users.update({_id:user._id}, {$set:update});
|
||||
if(res.hasWriteError()) {
|
||||
|
|
Loading…
Reference in a new issue