mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-29 18:50:07 +00:00
fix: tasks getting replaced when switching projects in work view #69
This commit is contained in:
parent
f4b7887a36
commit
adcc034196
1 changed files with 15 additions and 7 deletions
|
|
@ -25,17 +25,21 @@
|
|||
}
|
||||
|
||||
/* @ngInject */
|
||||
function WorkViewCtrl(Tasks, $window, $scope, Dialogs, $rootScope, TasksUtil, $timeout) {
|
||||
function WorkViewCtrl(Tasks, $window, $scope, Dialogs, $rootScope, TasksUtil, $timeout, EV_PROJECT_CHANGED) {
|
||||
let vm = this;
|
||||
const _ = $window._;
|
||||
|
||||
// INIT
|
||||
vm.session = $rootScope.r.currentSession;
|
||||
vm.config = $rootScope.r.config;
|
||||
vm.tasksUndone = Tasks.getUndoneToday();
|
||||
vm.tasksDone = Tasks.getDoneToday();
|
||||
updateTimeTotals();
|
||||
focusFirstTask();
|
||||
function init() {
|
||||
vm.session = $rootScope.r.currentSession;
|
||||
vm.config = $rootScope.r.config;
|
||||
vm.tasksUndone = Tasks.getUndoneToday();
|
||||
vm.tasksDone = Tasks.getDoneToday();
|
||||
updateTimeTotals();
|
||||
focusFirstTask();
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
// PRIVATE FUNCTIONS
|
||||
// -----------------
|
||||
|
|
@ -133,6 +137,10 @@
|
|||
updateTasksLsOnly();
|
||||
}));
|
||||
|
||||
$scope.$on(EV_PROJECT_CHANGED, () => {
|
||||
init();
|
||||
});
|
||||
|
||||
// otherwise we update on view change
|
||||
$scope.$on('$destroy', () => {
|
||||
updateGlobalTaskModel();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue