v3 client: only load completed todos once

This commit is contained in:
Matteo Pagliazzi
2016-05-17 19:31:59 +02:00
parent 2064db364f
commit b963acb91b
2 changed files with 5 additions and 1 deletions

View File

@@ -150,9 +150,12 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
$scope._today = moment().add({days: 1}); $scope._today = moment().add({days: 1});
$scope.loadedCompletedTodos = function () { $scope.loadedCompletedTodos = function () {
if (Tasks.loadedCompletedTodos === true) return;
Tasks.getUserTasks(true) Tasks.getUserTasks(true)
.then(function (response) { .then(function (response) {
User.user.todos.concat(response.data.data); User.user.todos = User.user.todos.concat(response.data.data);
Tasks.loadedCompletedTodos = true;
}); });
} }

View File

@@ -181,6 +181,7 @@ angular.module('habitrpg')
return { return {
getUserTasks: getUserTasks, getUserTasks: getUserTasks,
loadedCompletedTodos: false,
createUserTasks: createUserTasks, createUserTasks: createUserTasks,
getChallengeTasks: getChallengeTasks, getChallengeTasks: getChallengeTasks,
createChallengeTasks: createChallengeTasks, createChallengeTasks: createChallengeTasks,