LP#1747963 Fix "trim list" feature in web client user/rsteed/lp1747963_checkin_trim_list_fix
authorRemington Steed <rjs7@calvin.edu>
Wed, 7 Feb 2018 19:41:47 +0000 (14:41 -0500)
committerRemington Steed <rjs7@calvin.edu>
Wed, 7 Feb 2018 21:18:04 +0000 (16:18 -0500)
The use of splice() here caused buggy behavior and seemed to be a typo,
so I tried using slice() instead. But that still didn't work correctly.
The list stopped adding items after it reached 21 total, so scanning a
new barcode didn't add it to the list but only refreshed the list.

Instead, this commit sets the length of the array to 20, which shortens
the array as described in the MDN documentation for Array.length. Now it
behaves like it did in the XUL client.

Signed-off-by: Remington Steed <rjs7@calvin.edu>
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js

index 0a71c3f..211404e 100644 (file)
@@ -218,7 +218,8 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg
             }
 
             if ($scope.trim_list && checkinSvc.checkins.length > 20)
-                checkinSvc.checkins = checkinSvc.checkins.splice(0, 20);
+                //cut array short at 20 items
+                checkinSvc.checkins.length = 20;
         },
         function() {
             // Checkin was rejected somewhere along the way.