From b2cd9c0d0f3eec59cb122e57fd1bffd5b06a5b37 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 8 Aug 2012 09:57:32 -0400 Subject: [PATCH] use Addthis, some other attempts at fixing the weird bug --- lib/app/scoring.js | 5 ++++- src/app/index.coffee | 4 ++-- src/app/scoring.coffee | 4 +++- views/app/index.html | 12 ++++++------ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/app/scoring.js b/lib/app/scoring.js index d7829a095d..09b7a4e20e 100644 --- a/lib/app/scoring.js +++ b/lib/app/scoring.js @@ -114,8 +114,11 @@ module.exports.tally = function(model) { todoTally = 0; _.each(user.get('tasks'), function(taskObj, taskId, list) { var absVal, completed, task, type, value, _ref; + if (taskObj.id == null) { + return; + } _ref = [taskObj.type, taskObj.value, taskObj.completed], type = _ref[0], value = _ref[1], completed = _ref[2]; - task = model.at("_user.tasks." + taskId); + task = user.at("tasks." + taskId); if (type === 'todo' || type === 'daily') { if (!completed) { score({ diff --git a/src/app/index.coffee b/src/app/index.coffee index da3886c6d0..140c597561 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -10,7 +10,7 @@ schema = require('./schema') helpers = require('./helpers') helpers.viewHelpers(view) # $ = require('jQuery') -# _ = require('underscore') +# und = require('underscore') # node.js uses _ # ========== ROUTES ========== @@ -69,7 +69,7 @@ get '/:uidParam?', (page, model, {uidParam}) -> ready (model) -> - model.set '_purl', window.location.origin + '/' + model.get('_userId') + model.set('_purl', (window.location.origin + '/' + model.get('_userId'))) $('[rel=popover]').popover() #TODO: this isn't very efficient, do model.on set for specific attrs for popover diff --git a/src/app/scoring.coffee b/src/app/scoring.coffee index 39de5b46c6..290b437761 100644 --- a/src/app/scoring.coffee +++ b/src/app/scoring.coffee @@ -102,8 +102,10 @@ module.exports.tally = (model) -> user = model.at '_user' todoTally = 0 _.each user.get('tasks'), (taskObj, taskId, list) -> + #FIXME is it hiccuping here? taskId == "$_65255f4e-3728-4d50-bade-3b05633639af_2", & taskObj.id = undefined + return unless taskObj.id? #this shouldn't be happening, some tasks seem to be corrupted [type, value, completed] = [taskObj.type, taskObj.value, taskObj.completed] - task = model.at("_user.tasks.#{taskId}") + task = user.at("tasks.#{taskId}") if type in ['todo', 'daily'] # Deduct experience for missed Daily tasks, # but not for Todos (just increase todo's value) diff --git a/views/app/index.html b/views/app/index.html index 587afcf206..0ab074600a 100644 --- a/views/app/index.html +++ b/views/app/index.html @@ -62,7 +62,7 @@
- +
@@ -172,12 +172,12 @@ - +
- + {/} @@ -318,8 +318,8 @@ - + {#unless _mobileDevice}{/} - {#unless _mobileDevice}{/} + \ No newline at end of file