aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2017-09-06 18:04:00 +0100
committerStruan Donald <struan@exo.org.uk>2017-09-07 16:09:34 +0100
commit12013d397d981efbc90d5fed1a7bb25eae23eb91 (patch)
treee706232145f08b96858782d22410dd832636b207
parentf57adcb38568a0321f349cd823fbd2578eacb2ef (diff)
sort body dashboard CSV export by report confirmed time
And update the tests to avoid a random failure caused by inconsistent ordering.
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm2
-rw-r--r--t/app/controller/dashboard.t8
2 files changed, 5 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index 867d0659b..f961660c0 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -181,7 +181,7 @@ sub export_as_csv {
my ($self, $c, $problems_rs, $body) = @_;
require Text::CSV;
my $problems = $problems_rs->search(
- {}, { prefetch => 'comments' });
+ {}, { prefetch => 'comments', order_by => 'me.confirmed' });
my $filename = do {
my %where = (
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
index 5c0e19070..457eceade 100644
--- a/t/app/controller/dashboard.t
+++ b/t/app/controller/dashboard.t
@@ -531,12 +531,12 @@ FixMyStreet::override_config {
desc => 'Selecting no state does nothing',
p1 => {
state => 'fixed - user',
- conf_dt => DateTime->now(),
+ conf_dt => DateTime->now()->subtract( minutes => 1 ),
category => 'Potholes',
},
p2 => {
state => 'confirmed',
- conf_dt => DateTime->now(),
+ conf_dt => DateTime->now()->subtract( minutes => 1 ),
category => 'Litter',
},
state => '',
@@ -553,12 +553,12 @@ FixMyStreet::override_config {
desc => 'All fixed states count as fixed',
p1 => {
state => 'fixed - council',
- conf_dt => DateTime->now(),
+ conf_dt => DateTime->now()->subtract( minutes => 1 ),
category => 'Potholes',
},
p2 => {
state => 'fixed',
- conf_dt => DateTime->now(),
+ conf_dt => DateTime->now()->subtract( minutes => 1 ),
category => 'Potholes',
},
state => 'fixed',