webstaff: work log: display entries in order collab/gmcharlt/webstaff-transit-worklog-fixes
authorGalen Charlton <gmc@esilibrary.com>
Wed, 4 May 2016 21:16:14 +0000 (17:16 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 4 May 2016 21:16:14 +0000 (17:16 -0400)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/web/js/ui/default/staff/admin/workstation/log.js

index 39dbc72..b2411e2 100644 (file)
@@ -86,7 +86,6 @@ function($scope , $q , $routeParams , $window , $timeout , egCore , egGridDataPr
                 if (hold.current_copy()) {
                     entry.item = hold.current_copy().barcode();
                 }
-                deferred.notify(entry);
             }
         );
     }
@@ -97,7 +96,6 @@ function($scope , $q , $routeParams , $window , $timeout , egCore , egGridDataPr
         ).then(
             function(usr) {
                 entry.user = usr.family_name();
-                deferred.notify(entry);
             }
         );
     }
@@ -114,6 +112,9 @@ function($scope , $q , $routeParams , $window , $timeout , egCore , egGridDataPr
         entries.forEach(
             function(el,idx) {
                 el.id = idx;
+                // notify right away and in order; fetch_* will
+                // fill in entry later if necessary
+                promises.push($timeout(function() { deferred.notify(el) }));
                 if (el.action == 'requested_hold') {
                     promises.push(fetch_hold(deferred,el));
                 } else if (el.action == 'registered_patron') {
@@ -122,8 +123,6 @@ function($scope , $q , $routeParams , $window , $timeout , egCore , egGridDataPr
                     promises.push(fetch_patron(deferred,el));
                 } else if (el.action == 'paid_bill') {
                     promises.push(fetch_patron(deferred,el));
-                } else {
-                    promises.push($timeout(function() { deferred.notify(el) }));
                 }
             }
         );
@@ -144,6 +143,9 @@ function($scope , $q , $routeParams , $window , $timeout , egCore , egGridDataPr
         log_entries.patron_log.forEach(
             function(el,idx) {
                 el.id = idx;
+                // notify right away and in order; fetch_* will
+                // fill in entry later if necessary
+                promises.push($timeout(function() { deferred.notify(el) }));
                 if (el.action == 'requested_hold') {
                     promises.push(fetch_hold(deferred,el));
                 } else if (el.action == 'registered_patron') {
@@ -152,8 +154,6 @@ function($scope , $q , $routeParams , $window , $timeout , egCore , egGridDataPr
                     promises.push(fetch_patron(deferred,el));
                 } else if (el.action == 'paid_bill') {
                     promises.push(fetch_patron(deferred,el));
-                } else {
-                    promises.push($timeout(function() { deferred.notify(el) }));
                 }
             }
         );