diff --git a/src/app/schema.coffee b/src/app/schema.coffee index 0c7f8b30d9..da0b48d7fb 100644 --- a/src/app/schema.coffee +++ b/src/app/schema.coffee @@ -23,37 +23,4 @@ module.exports.userSchema = -> when 'daily' then newUser.dailyIds.push guid when 'todo' then newUser.todoIds.push guid when 'reward' then newUser.rewardIds.push guid - return newUser - -module.exports.updateSchema = (model) -> - return # not using, will revisit this later - # Reset history, remove inactive users - model.fetch 'users', (err, users) -> - _.each users.get(), (userObj) -> - userPath = "users.#{userObj._id}" - user = model.at(userPath) - - # Remove inactive users - # remove if they don't have a lastCron (older accounts didn't) - unless userObj.lastCron? - model.del(userPath) - return - - # Remove all users who haven't logged in for a month - daysOld = helpers.daysBetween(new Date(), userObj.lastCron) - if daysOld > 30 - # and who have mostly the default tasks - sameTasks = _.filter require('./content').defaultTasks, (defaultTask) -> - foundSame = _.find userObj.tasks, (userTask) -> - userTask.text == defaultTask.text - return foundSame? - if _.size(sameTasks)>5 - model.del(userPath) - return - - # Reset all history - user.set 'history', {exp:[], todos:[]} - _.each userObj.tasks, (taskObj) -> - task = user.at "tasks.#{taskObj.id}" - if task.get("history") - task.set "history", [] + return newUser \ No newline at end of file