mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 11:40:25 +00:00
remove duplicates on the server instead
Conflicts: lib/app/index.js
This commit is contained in:
parent
c76fe1424e
commit
d5cc627c74
4 changed files with 7 additions and 8 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Reference in a new issue