From c20552b99f6bd29a8386d4afa1cf6d8205373177 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 15 Nov 2012 23:14:59 -0500 Subject: [PATCH] only set unique idlists if there were duplicates to begin with --- src/app/index.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/index.coffee b/src/app/index.coffee index 239ee6d326..9786667999 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -59,8 +59,11 @@ get '/:uid?', (page, model, {uid}, next) -> # 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) - + orig = user.get(path) + unique = _.uniq(orig, true) + if orig.length != unique.length + user.set path, unique + # Setup Model Functions model.fn '_user._tnl', '_user.stats.lvl', (lvl) -> # see https://github.com/lefnire/habitrpg/issues/4