Don't display chart if history is empty.

This commit is contained in:
Collin Styles 2014-07-31 14:56:52 -07:00
parent e10c04c9bc
commit 0b01ff2201

View file

@ -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']];