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("_todoList", "_user.tasks", "_user.todoIds");
|
||||||
model.refList("_completedList", "_user.tasks", "_user.completedIds");
|
model.refList("_completedList", "_user.tasks", "_user.completedIds");
|
||||||
model.refList("_rewardList", "_user.tasks", "_user.rewardIds");
|
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) {
|
model.fn('_user._tnl', '_user.stats.lvl', function(lvl) {
|
||||||
return (lvl * 100) / 5;
|
return (lvl * 100) / 5;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -252,9 +252,6 @@ score = function(taskId, direction, options) {
|
|||||||
|
|
||||||
cron = function() {
|
cron = function() {
|
||||||
var daysPassed, hpTally, lastCron, tallyTask, tasks, today, todoTally;
|
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();
|
today = new Date();
|
||||||
user.setNull('lastCron', today);
|
user.setNull('lastCron', today);
|
||||||
lastCron = user.get('lastCron');
|
lastCron = user.get('lastCron');
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ get '/:uid?', (page, model, {uid}, next) ->
|
|||||||
model.refList "_completedList", "_user.tasks", "_user.completedIds"
|
model.refList "_completedList", "_user.tasks", "_user.completedIds"
|
||||||
model.refList "_rewardList", "_user.tasks", "_user.rewardIds"
|
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
|
# Setup Model Functions
|
||||||
model.fn '_user._tnl', '_user.stats.lvl', (lvl) ->
|
model.fn '_user._tnl', '_user.stats.lvl', (lvl) ->
|
||||||
# see https://github.com/lefnire/habitrpg/issues/4
|
# see https://github.com/lefnire/habitrpg/issues/4
|
||||||
|
|||||||
@@ -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)
|
# At end of day, add value to all incomplete Daily & Todo tasks (further incentive)
|
||||||
# For incomplete Dailys, deduct experience
|
# For incomplete Dailys, deduct experience
|
||||||
cron = ->
|
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()
|
today = new Date()
|
||||||
user.setNull 'lastCron', today
|
user.setNull 'lastCron', today
|
||||||
lastCron = user.get('lastCron')
|
lastCron = user.get('lastCron')
|
||||||
|
|||||||
Reference in New Issue
Block a user