From 3199652694d304b17dcc787d473f5efaa64b9cb3 Mon Sep 17 00:00:00 2001 From: Arjun Roychowdhury Date: Fri, 20 Nov 2015 17:28:35 -0500 Subject: #104 - handle less than items per page count Former-commit-id: add9fb5776836feb551e013c676a3eed4ff7a66f --- www/js/TimelineCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'www/js/TimelineCtrl.js') diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js index 7f100ff5..048fc03e 100644 --- a/www/js/TimelineCtrl.js +++ b/www/js/TimelineCtrl.js @@ -466,7 +466,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla // I figure out how many items the server returns per API page // and divide the # of items I want (currently 200) with # of items per page // So iterCount is the # of HTTP calls I need to make - iterCount = Math.round(count / itemsPerPage); + iterCount = Math.max(Math.round(count / itemsPerPage),1); ZMDataModel.zmDebug("TimelineCtrl/drawGraph: pages of data: " + pages + " items per page: " + itemsPerPage); ZMDataModel.zmDebug("TimelineCtrl/drawGraph: I will make " + iterCount + " HTTP Requests to get all graph data"); -- cgit v1.2.3