openplans / openblock

OpenBlock is a web application and RESTful service that allows users to browse and search their local area for "hyper-local news
61 stars 26 forks source link

Pagination on place_detail page can skip items #275

Closed slinkp closed 11 years ago

slinkp commented 11 years ago

Place detail page does a sort of pagination by date; see eg. http://demo.openblockproject.org/locations/zipcodes/02116/ and note the "older news" link at bottom.

When there's a lot of news, the "older news" link can skip some items.

Why:

The page by default shows 7 days of news (or settings.DEFAULT_DAYS). At page bottom is an "older news" link. It links to the day before the last day shown on this page. That's fine if the page is showing all news within that date range. Problem is, the database query is also capped at constants.NUM_NEWS_ITEMS_PLACE_DETAIL, which is 300 by default. If you hit that cap before you get to the end of a day's worth of news, the rest of the news from that day will be skipped when you follow the link to the next day.

Example:

slinkp commented 11 years ago

(In [2b33d1b3cf080a20006b389147cd3720b5478afc]) Place detail page: Use page-number-based pagination, not date-based. Fixes #282.

slinkp commented 11 years ago

Ticket imported from Trac: http://developer.openblockproject.org/ticket/282 Reported by: slinkp