fix issue when task order is not saved

This commit is contained in:
Johannes Millan 2017-01-06 22:11:18 +01:00
parent 7963f57b5e
commit 7eb8e501b6

View file

@ -30,9 +30,13 @@
vm.r = $rootScope.r;
//vm.tasks = $rootScope.r.tasks;
//vm.backlogTasks = $rootScope.r.backlogTasks;
//vm.currentTask = $rootScope.r.currentTask;
function mergeDoneAndUndone() {
// we need to re-merge because of splitting up the tasks into two
if (vm.tasksUndone && vm.tasksDone) {
let newTaskList = vm.tasksDone.concat(vm.tasksUndone);
Tasks.updateToday(newTaskList);
}
}
vm.openAddTask = () => {
Dialogs('ADD_TASK');
@ -54,6 +58,9 @@
}
};
$scope.$watch('vm.tasksDone', mergeDoneAndUndone, true);
$scope.$watch('vm.tasksUndone', mergeDoneAndUndone, true);
$scope.$watch('vm.r.tasks', () => {
vm.tasksUndone = Tasks.getUndoneToday();
vm.tasksDone = Tasks.getDoneToday();