LP#1739648 - fix item duplication in itemsout and holds grids
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Thu, 4 Jan 2018 22:36:02 +0000 (17:36 -0500)
committerMike Rylander <mrylander@gmail.com>
Mon, 12 Feb 2018 20:41:45 +0000 (15:41 -0500)
Since these grids have caching, if the offset was greater
the cached data length, the grid would try to fetch data again, even if
it's already there, pushing duplicate items into the cache. This should
prevent that.

Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>

Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/web/js/ui/default/staff/circ/patron/holds.js
Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js

index 41e0223..6d017d4 100644 (file)
@@ -90,7 +90,7 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,
             egCore.auth.token(), $scope.patron_id
 
         ).then(function(hold_ids) {
-            if (!hold_ids.length) { deferred.resolve(); return; }
+            if (!hold_ids.length || hold_ids.length < offset + 1) { deferred.resolve(); return; }
 
             patronSvc.hold_ids = hold_ids;
             fetchHolds(offset, count)
index 6679af6..daf0041 100644 (file)
@@ -96,7 +96,7 @@ function($scope,  $q,  $routeParams,  $timeout,  egCore , egUser,  patronSvc , $
     $scope.gridDataProvider = provider;
 
     function fetch_circs(id_list, offset, count) {
-        if (!id_list.length) return $q.when();
+        if (!id_list.length || id_list.length < offset + 1) return $q.when();
 
         var deferred = $q.defer();
         var rendered = 0;