alphagov/whitehall — pull request #1673 by GrouchPotato (2014-08-19 12:14:48+00:00)
Title: Show recent cancelled stats announcements on index

The statics announcement index needs to also include cancelled
announcements which were originally due to be published within the
last month. As some stats announcements (ones without a linked
publication) remain in the index, the filter assumes a from_date of
now if one isn't specified to filter out those old announcements.
Thus, we have to go and get the cancelled announcements between now
and 1 month ago and prepend them to the results.

This only applies if the user has not selected a from_date and
is on page 1.

There are very few cancelled announcements (6 or 7 a year), so we're
only ever likely to increase the first page length by 1 or 2 at any
given time. This may in some cases cause the pagination to incorrectly
count the number of pages as the total number of pages can no longer
be exactly calculated from the total result count / number per page.
The symptom of such an error would be a blank page at the end, which
probably isn't the end of the world.

A cleaner solution would require changes to how stats announcements
are indexed and it was decided that this grungy approach was the better
way to go for now.

[ ] Pass product review