diff --git a/src/app/challenges.coffee b/src/app/challenges.coffee index 7d5d1b1ffd..5d61133a7c 100644 --- a/src/app/challenges.coffee +++ b/src/app/challenges.coffee @@ -5,13 +5,13 @@ module.exports.app = (appExports, model) -> browser = require './browser' user = model.at '_user' - appExports.renderChallengeGraphs = -> + $('#profile-challenges-tab-link').on 'show', (e) -> _.each model.get('groups'), (g) -> _.each g.challenges, (chal) -> _.each ['habit','daily','todo'], (type) -> _.each chal["#{type}s"], (task) -> _.each chal.users, (member) -> - if (history = member["#{type}s"][task.id].history) and !!history + if (history = member?["#{type}s"]?[task.id]?.history) and !!history data = google.visualization.arrayToDataTable _.map(history, (h)-> [h.date,h.value]) options = backgroundColor: { fill:'transparent' } @@ -25,6 +25,7 @@ module.exports.app = (appExports, model) -> chart = new google.visualization.LineChart $(".challenge-#{chal.id}-member-#{member.id}-history-#{task.id}")[0] chart.draw(data, options) + appExports.challengeCreate = (e,el) -> [type, gid] = [$(el).attr('data-type'), $(el).attr('data-gid')] model.set '_challenge.new', diff --git a/views/app/game-pane.html b/views/app/game-pane.html index 9211621806..42ab861773 100644 --- a/views/app/game-pane.html +++ b/views/app/game-pane.html @@ -14,7 +14,7 @@ {/if}