diff --git a/app-src/scripts/work-view/work-view-d.js b/app-src/scripts/work-view/work-view-d.js index dd926690a4..9808f375ca 100644 --- a/app-src/scripts/work-view/work-view-d.js +++ b/app-src/scripts/work-view/work-view-d.js @@ -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();