aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/ResultSet/Problem.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-06-12 17:46:47 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-07-03 15:55:52 +0100
commit1b7418e2aec2ce269fde49efcff8493e4e24ad7e (patch)
tree2761dc4196b1c5f306b4e498ee633a5e939f2d9b /perllib/FixMyStreet/DB/ResultSet/Problem.pm
parent04e49afc9a7c10405464c62b0cfd6f6c55b286ac (diff)
Only display reports from last 6 months on around.
Add a checkbox to show older reports, plus if we get to the end of the new reports then instead of a Next button show a "show older" button that will reload the current page but with older reports also loaded. Wire it all up into the pushState code as well.
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 967c90af5..cc28e4c33 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -172,6 +172,9 @@ sub around_map {
latitude => { '>=', $p{min_lat}, '<', $p{max_lat} },
longitude => { '>=', $p{min_lon}, '<', $p{max_lon} },
};
+
+ $q->{$c->stash->{report_age_field}} = { '>=', \"current_timestamp-'$p{report_age}'::interval" } if
+ $p{report_age};
$q->{category} = $p{categories} if $p{categories} && @{$p{categories}};
$rs->non_public_if_possible($q, $c);