aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/update-all-reports2
-rw-r--r--t/app/controller/reports.t10
2 files changed, 10 insertions, 2 deletions
diff --git a/bin/update-all-reports b/bin/update-all-reports
index e60d7ddef..75a7cddd1 100755
--- a/bin/update-all-reports
+++ b/bin/update-all-reports
@@ -64,7 +64,7 @@ while ( my @problem = $problems->next ) {
$fixed{$body}{$duration_str}++;
} else {
# Open problems are either unknown, older, or new
- $open{$body}{$type}++ if $problem{state} eq 'confirmed';
+ $open{$body}{$type}++;
}
}
}
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index 503950d8a..14a4b2150 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -21,6 +21,12 @@ my @westminster_problems = $mech->create_problems_for_body(5, 2504, 'All reports
is scalar @westminster_problems, 5, 'correct number of westminster problems created';
is scalar @edinburgh_problems, 3, 'correct number of edinburgh problems created';
+$edinburgh_problems[1]->update( {
+ state => 'in progress',
+ confirmed => DateTime->now()->subtract( weeks => 6 ),
+ lastupdate => DateTime->now()->subtract( weeks => 5 ),
+} );
+
# Run the cron script that makes the data for /reports so we don't get an error.
system( "bin/cron-wrapper update-all-reports" );
@@ -31,7 +37,9 @@ $mech->content_contains('Birmingham');
my $stats = $mech->extract_report_stats;
-is $stats->{'City of Edinburgh Council'}->[1], 3, 'correct number of reports for Edinburgh';
+is $stats->{'City of Edinburgh Council'}->[1], 2, 'correct number of new reports for Edinburgh';
+is $stats->{'City of Edinburgh Council'}->[2], 1, 'correct number of older reports for Edinburgh';
+
is $stats->{'Westminster City Council'}->[1], 5, 'correct number of reports for Westminster';
$mech->follow_link_ok( { text_regex => qr/Birmingham/ } );