aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-05-21 00:29:08 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-05-21 00:29:08 +0100
commit8fbb9539e8ada7faf6c54c40bda7d059bdfd0c12 (patch)
treec16ed9eed6ec9f1272253dbfb098979a47c49216
parentc804762c2fa0b855fca4c2388c6a47f09913b966 (diff)
Fix bug whereby 'old and of unknown status' was shown on all open reports.
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm2
-rw-r--r--t/app/controller/report_display.t9
2 files changed, 10 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 7920a15d6..37c5f478b 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -783,7 +783,7 @@ sub generate_problem_banner {
my ( $self, $problem ) = @_;
my $banner = {};
- if ($problem->state eq 'confirmed' && $problem->get_column('time') > 8*7*24*60*60) {
+ if ($problem->state eq 'confirmed' && $problem->get_column('duration') > 8*7*24*60*60) {
$banner->{id} = 'unknown';
$banner->{text} = _('This problem is old and of unknown status.');
}
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index aa7e507d9..1f857a387 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -190,6 +190,14 @@ foreach my $meta (
for my $test (
{
+ description => 'new report',
+ date => DateTime->now,
+ state => 'confirmed',
+ banner_id => '',
+ banner_text => '',
+ fixed => 0
+ },
+ {
description => 'old report',
date => DateTime->new(
year => 2009,
@@ -230,6 +238,7 @@ for my $test (
) {
subtest "banner for $test->{description}" => sub {
$report->confirmed( $test->{date}->ymd . ' ' . $test->{date}->hms );
+ $report->lastupdate( $test->{date}->ymd . ' ' . $test->{date}->hms );
$report->state( $test->{state} );
$report->update;