From 0b01ff2201d4310b13e47d49d1b9d813366bed27 Mon Sep 17 00:00:00 2001 From: Collin Styles Date: Thu, 31 Jul 2014 14:56:52 -0700 Subject: [PATCH] Don't display chart if history is empty. --- public/js/controllers/rootCtrl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index 15b3a994f2..2186fe9774 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -163,16 +163,16 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ var history = [], matrix, data, chart, options; switch (id) { case 'exp': - $rootScope.charts.exp = !$rootScope.charts.exp; history = User.user.history.exp; + $rootScope.charts.exp = (history.length == 0) ? false : !$rootScope.charts.exp; break; case 'todos': - $rootScope.charts.todos = !$rootScope.charts.todos; history = User.user.history.todos; + $rootScope.charts.todos = (history.length == 0) ? false : !$rootScope.charts.todos; break; default: - $rootScope.charts[id] = !$rootScope.charts[id]; history = task.history; + $rootScope.charts[id] = (history.length == 0) ? false : !$rootScope.charts[id]; if (task && task._editing) task._editing = false; } matrix = [['Date', 'Score']];