##// END OF EJS Templates
fixed issues with repo pager
marcink -
r1422:e69da281 beta
parent child Browse files
Show More
@@ -7,6 +7,7 b' import random'
7 import hashlib
7 import hashlib
8 import StringIO
8 import StringIO
9 import urllib
9 import urllib
10 import math
10
11
11 from datetime import datetime
12 from datetime import datetime
12 from pygments.formatters import HtmlFormatter
13 from pygments.formatters import HtmlFormatter
@@ -513,7 +514,8 b' class RepoPage(Page):'
513 # Compute the number of the first and last available page
514 # Compute the number of the first and last available page
514 if self.item_count > 0:
515 if self.item_count > 0:
515 self.first_page = 1
516 self.first_page = 1
516 self.page_count = ((self.item_count - 1) / self.items_per_page) + 1
517 self.page_count = int(math.ceil(float(self.item_count) /
518 self.items_per_page))
517 self.last_page = self.first_page + self.page_count - 1
519 self.last_page = self.first_page + self.page_count - 1
518
520
519 # Make sure that the requested page number is the range of valid pages
521 # Make sure that the requested page number is the range of valid pages
@@ -524,8 +526,10 b' class RepoPage(Page):'
524
526
525 # Note: the number of items on this page can be less than
527 # Note: the number of items on this page can be less than
526 # items_per_page if the last page is not full
528 # items_per_page if the last page is not full
527 self.first_item = max(0, (self.item_count) - (self.page * items_per_page))
529 self.first_item = max(0, (self.item_count) - (self.page *
528 self.last_item = ((self.item_count - 1) - items_per_page * (self.page - 1))
530 items_per_page))
531 self.last_item = ((self.item_count - 1) - items_per_page *
532 (self.page - 1))
529
533
530 iterator = self.collection.get_changesets(start=self.first_item,
534 iterator = self.collection.get_changesets(start=self.first_item,
531 end=self.last_item,
535 end=self.last_item,
General Comments 0
You need to be logged in to leave comments. Login now