mysociety / alaveteli

Provide a Freedom of Information request system for your jurisdiction
https://alaveteli.org
Other
389 stars 195 forks source link

Request pagination page count on authorities is wrong #2414

Open stevenday opened 9 years ago

stevenday commented 9 years ago

Viewing requests by authority, I see a list pagination links at the bottom. For some reason, this is exaggerating the number of requests available.

For example: https://www.whatdotheyknow.com/body/brighton_and_hove_city_council shows 118 pages, but there are actually only 20 that don't error.

Something similar but more subtle also happens when I use the date range filter. For example: https://www.whatdotheyknow.com/body/brighton_and_hove_city_council/awaiting?utf8=%E2%9C%93&query=&request_date_after=2015%2F05%2F05&request_date_before=2015%2F05%2F07&commit=Search Really only has 2 pages of requests, but shows 23 when I'm on the first page. However if you visit the second page, it manages to work it out properly.

Presumably it's looking at the wrong list of requests initially or something?

(I've marked this as UK because I haven't tested it elsewhere to see if it's a problem there too)

garethrees commented 9 years ago

Probably #2137

crowbot commented 9 years ago

I think #2137 is responsible for the first part of the description here, but not for the more subtle issue @stevenday describes in the second para.

garethrees commented 9 years ago

Nicaragua have also reported something similar.

The header says "20 FOI requests found", but then there are only 18 listed underneath (no pagination).

> InfoRequest.count
  (1.7ms)  SELECT COUNT(*) FROM "info_requests"
=> 19

18 must be the correct number, since the 19 in the database include the holding pen request.

garethrees commented 9 years ago

Related – possibly fixes: https://github.com/mysociety/alaveteli/issues/286