mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
remove duplicates on the server instead
Conflicts: lib/app/index.js
This commit is contained in:
@@ -52,6 +52,9 @@ get('/:uid?', function(page, model, _arg, next) {
|
||||
model.refList("_todoList", "_user.tasks", "_user.todoIds");
|
||||
model.refList("_completedList", "_user.tasks", "_user.completedIds");
|
||||
model.refList("_rewardList", "_user.tasks", "_user.rewardIds");
|
||||
_.each(['habitIds', 'dailyIds', 'todoIds', 'rewardIds'], function(path) {
|
||||
return user.set(path, _.uniq(user.get(path), true));
|
||||
});
|
||||
model.fn('_user._tnl', '_user.stats.lvl', function(lvl) {
|
||||
return (lvl * 100) / 5;
|
||||
});
|
||||
|
||||
@@ -252,9 +252,6 @@ score = function(taskId, direction, options) {
|
||||
|
||||
cron = function() {
|
||||
var daysPassed, hpTally, lastCron, tallyTask, tasks, today, todoTally;
|
||||
_.each(['habitIds', 'dailyIds', 'todoIds', 'rewardIds'], function(path) {
|
||||
return user.set(path, _.uniq(user.get(path)));
|
||||
});
|
||||
today = new Date();
|
||||
user.setNull('lastCron', today);
|
||||
lastCron = user.get('lastCron');
|
||||
|
||||
@@ -49,6 +49,10 @@ get '/:uid?', (page, model, {uid}, next) ->
|
||||
model.refList "_todoList", "_user.tasks", "_user.todoIds"
|
||||
model.refList "_completedList", "_user.tasks", "_user.completedIds"
|
||||
model.refList "_rewardList", "_user.tasks", "_user.rewardIds"
|
||||
|
||||
# FIXME temporary hack to remove duplicates. Need to figure out why they're being produced
|
||||
_.each ['habitIds','dailyIds','todoIds','rewardIds'], (path) ->
|
||||
user.set path, _.uniq(user.get(path), true)
|
||||
|
||||
# Setup Model Functions
|
||||
model.fn '_user._tnl', '_user.stats.lvl', (lvl) ->
|
||||
|
||||
@@ -210,11 +210,6 @@ score = (taskId, direction, options={cron:false, times:1}) ->
|
||||
# At end of day, add value to all incomplete Daily & Todo tasks (further incentive)
|
||||
# For incomplete Dailys, deduct experience
|
||||
cron = ->
|
||||
|
||||
# FIXME temporary hack to remove duplicates. Need to figure out why they're being produced
|
||||
_.each ['habitIds','dailyIds','todoIds','rewardIds'], (path) ->
|
||||
user.set path, _.uniq(user.get(path))
|
||||
|
||||
today = new Date()
|
||||
user.setNull 'lastCron', today
|
||||
lastCron = user.get('lastCron')
|
||||
|
||||
Reference in New Issue
Block a user