makes smaller fetching batch

This commit is contained in:
2016-02-12 18:54:24 +01:00
parent c5f294a818
commit 540637580a

View File

@@ -24,13 +24,14 @@ angular.module('satbd.satellite.bar.views.recents',[
}); });
$scope.loadMore = function() { $scope.loadMore = function() {
var batchSize =20;
$log.info('Loading more components'); $log.info('Loading more components');
if (!$scope.scrollMore || $scope.albumIDs.length >= $scope.allAlbums.length) { if (!$scope.scrollMore || $scope.albumIDs.length >= $scope.allAlbums.length) {
$scope.scrollMore = false; $scope.scrollMore = false;
$log.info('reached the end of albums') $log.info('reached the end of albums')
return; return;
} }
var newSize = Math.min($scope.albumIDs.length + 50, $scope.allAlbums.length); var newSize = Math.min($scope.albumIDs.length + batchSize, $scope.allAlbums.length);
for( var i = $scope.albumIDs.length; i < newSize; i++) { for( var i = $scope.albumIDs.length; i < newSize; i++) {
$scope.albumIDs.push($scope.allAlbums[i]); $scope.albumIDs.push($scope.allAlbums[i]);
} }