From b83ea83e34db5959ef1fb319083c08d2398c9add Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Fri, 6 Jan 2017 14:02:47 +0000
Subject: [PATCH] Task #10057: removed flaky delayed async update

---
 .../app/controllers/ganttprojectcontroller.js    | 16 +---------------
 .../app/controllers/ganttresourcecontroller.js   | 16 +---------------
 .../lib/static/app/controllers/gridcontroller.js | 16 +---------------
 3 files changed, 3 insertions(+), 45 deletions(-)

diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttprojectcontroller.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttprojectcontroller.js
index 934afd7b818..b3e1e2bfb97 100644
--- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttprojectcontroller.js
+++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttprojectcontroller.js
@@ -28,8 +28,6 @@ ganttProjectControllerMod.controller('GanttProjectController', ['$scope', 'dataS
     $scope.enabled = true;
 
     self.taskStatusColors = dataService.taskStatusColors;
-    self.lastUpdateTimestamp = new Date(0);
-    self.waitingForDelayedUpdate = false;
 
     $scope.options = {
         mode: 'custom',
@@ -109,18 +107,7 @@ ganttProjectControllerMod.controller('GanttProjectController', ['$scope', 'dataS
     };
 
     function updateGanttDataAsync() {
-        var now = new Date();
-        var diff = now.getTime() - self.lastUpdateTimestamp.getTime();
-        if(diff > 500) {
-            self.waitingForDelayedUpdate = false;
-            $scope.$evalAsync(updateGanttData);
-        }
-        else {
-            if (!self.waitingForDelayedUpdate) {
-                self.waitingForDelayedUpdate = true;
-                setTimeout(updateGanttDataAsync, diff);
-            }
-        }
+        $scope.$evalAsync(updateGanttData);
     };
 
     function updateGanttData() {
@@ -322,7 +309,6 @@ ganttProjectControllerMod.controller('GanttProjectController', ['$scope', 'dataS
         }
 
         $scope.ganttData = ganntRows;
-        self.lastUpdateTimestamp = new Date();
     };
 
     $scope.$watch('dataService.initialLoadComplete', updateGanttDataAsync);
diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttresourcecontroller.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttresourcecontroller.js
index 9c201da4ac8..810d481e296 100644
--- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttresourcecontroller.js
+++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/ganttresourcecontroller.js
@@ -26,8 +26,6 @@ ganttResourceControllerMod.controller('GanttResourceController', ['$scope', 'dat
 
     self.taskStatusColors = dataService.taskStatusColors;
     self.resourceClaimStatusColors = dataService.resourceClaimStatusColors;
-    self.lastUpdateTimestamp = new Date(0);
-    self.waitingForDelayedUpdate = false;
 
     $scope.options = {
         mode: 'custom',
@@ -128,18 +126,7 @@ ganttResourceControllerMod.controller('GanttResourceController', ['$scope', 'dat
     };
 
     function updateGanttDataAsync() {
-        var now = new Date();
-        var diff = now.getTime() - self.lastUpdateTimestamp.getTime();
-        if(diff > 500) {
-            self.waitingForDelayedUpdate = false;
-            $scope.$evalAsync(updateGanttData);
-        }
-        else {
-            if (!self.waitingForDelayedUpdate) {
-                self.waitingForDelayedUpdate = true;
-                setTimeout(updateGanttDataAsync, diff);
-            }
-        }
+        $scope.$evalAsync(updateGanttData);
     };
 
     function updateGanttData() {
@@ -480,7 +467,6 @@ ganttResourceControllerMod.controller('GanttResourceController', ['$scope', 'dat
             ganttRows.push(ganttRowsDict[rowId]);
 
         $scope.ganttData = ganttRows;
-        self.lastUpdateTimestamp = new Date();
     };
 
     $scope.$watch('dataService.initialLoadComplete', updateGanttDataAsync);
diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js
index 0c0053601ab..90f61886dff 100644
--- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js
+++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js
@@ -9,8 +9,6 @@ var gridControllerMod = angular.module('GridControllerMod', ['ui.grid',
 gridControllerMod.controller('GridController', ['$scope', '$window', 'dataService', 'uiGridConstants', function($scope, $window, dataService, uiGridConstants) {
 
     var self = this;
-    self.lastUpdateTimestamp = new Date(0);
-    self.waitingForDelayedUpdate = false;
 
     $scope.dataService = dataService;
     
@@ -368,18 +366,7 @@ gridControllerMod.controller('GridController', ['$scope', '$window', 'dataServic
     };
 
     function populateListAsync() {
-        var now = new Date();
-        var diff = now.getTime() - self.lastUpdateTimestamp.getTime();
-        if(diff > 750) {
-            self.waitingForDelayedUpdate = false;
-            $scope.$evalAsync(populateList);
-        }
-        else {
-            if (!self.waitingForDelayedUpdate) {
-                self.waitingForDelayedUpdate = true;
-                setTimeout(populateListAsync, diff);
-            }
-        }
+        $scope.$evalAsync(populateList);
     };
 
     function populateList() {
@@ -439,7 +426,6 @@ gridControllerMod.controller('GridController', ['$scope', '$window', 'dataServic
 
         fillProjectsColumFilterSelectOptions()
         fillGroupsColumFilterSelectOptions();
-        self.lastUpdateTimestamp = new Date();
     };
 
     function jumpToSelectedTaskRows() {
-- 
GitLab