LP#1712854 - add misc fixes for bib hold grid fetching
authorMike Rylander <mrylander@gmail.com>
Fri, 15 Dec 2017 16:00:05 +0000 (11:00 -0500)
committerCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 15 Dec 2017 17:03:40 +0000 (12:03 -0500)
Only notify when we are inside the limit/count window.
Plus white space fix. Darn it Cesar, fix your Vim... ;)

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index 20bd078..7200401 100644 (file)
@@ -1690,8 +1690,11 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
                 var holds_fetched = 0;
                 fetchHolds().then(deferred.resolve, null, 
                     function(hold_data) {
+                        if (holds_fetched >= offset && holds_fetched < offset + count) {
+                            // We're in the window of holds we want to see
+                            deferred.notify(hold_data);
+                        }
                         holds_fetched++;
-                        deferred.notify(hold_data);
                         egProgressDialog.increment();
                     }
                 )['finally'](egProgressDialog.close);
@@ -1715,7 +1718,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
     $scope.pickup_ou = egCore.org.get(egCore.auth.user().ws_ou());
     $scope.pickup_ou_changed = function(org) {
         if($scope.pickup_ou.id() != org.id()){
-        $scope.pickup_ou = org;
+            $scope.pickup_ou = org;
             holds = []; // cached hold data is stale due to ou change, clear it
         }
         provider.refresh(false);