hotosm / osm-tasking-manager2

Designed and built for Humanitarian OpenStreetMap Team collaborative emergency/disaster mapping, the OSM Tasking Manager 2.0 divides an area into individual squares that can be rapidly mapped by thousands of volunteers.
http://tasks.hotosm.org
Other
425 stars 156 forks source link

Pagination with search term provides odd results #955

Closed CloCkWeRX closed 7 years ago

CloCkWeRX commented 7 years ago

http://tasks.hotosm.org/?direction=asc&page=2&search=NOAH&sort_by=priority

image

Page 2, I have a result that is present from page 1 and no further results; but also next/back/etc controls.

http://tasks.hotosm.org/?direction=asc&page=3&search=NOAH&sort_by=priority

Page 3 has similar results again

It seems that the search text vs pagination controls aren't fully linked together

pgiraud commented 7 years ago

Thanks for the report. Unfortunately, I don't get the same results as you do. In my browser (Chrome) I get 7 results on the second (and last page). I can't reproduce. DId you do something specific before doing such a search?

CloCkWeRX commented 7 years ago

Chrome, Ubuntu

  1. Visit home as a logged in user
  2. Enter 'NOAH', Search
  3. Use bottom pagination control to visit page 2, 3, etc

Expected: Normal results Actual: Weird results on subsequent pages.

I have reproduced it a few times over with the above steps over a few different days, had assumed it was something funny server side

CloCkWeRX commented 7 years ago

If I do the same search with not authenticated/new private browser window; it behaves correctly.

Log out, it returns to good/ok behaviour, log back in the bug returns (so not cookies, probably not a server side session issue).

ethan-nelson commented 7 years ago

I can confirm this behavior on my end as well. But, to replicate, I had to manually search the term and then go to page 2. Firefox 47.0.1 and Windows. Strangely, it didn't work when I first just clicked on the link.

pgiraud commented 7 years ago

OK, with an other user, I've been able to see the issue as well. Looks like an weird one.

pgiraud commented 7 years ago

So it looks like the pages count is bad. The query may not be correctly built. https://github.com/hotosm/osm-tasking-manager2/blob/master/osmtm/views/views.py#L76-L78