diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-21 17:54:16 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-21 17:54:16 +0100 |
commit | ddde474e6a1dfb1591e8cfe06dc05c8be3312853 (patch) | |
tree | 3b97c383534be926c4733aebf4b4228eb19c9013 | |
parent | 2f3388de9ee449080febabd47876620c82d56895 (diff) |
check for open states instead of confirmed
-rw-r--r-- | perllib/FixMyStreet/App/Controller/JSON.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 5 |
3 files changed, 9 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm index 3a3010911..d9baeaaf8 100644 --- a/perllib/FixMyStreet/App/Controller/JSON.pm +++ b/perllib/FixMyStreet/App/Controller/JSON.pm @@ -70,12 +70,12 @@ sub problems : Local { } # query the database - my ( $state, $date_col ); + my ( @state, $date_col ); if ( $type eq 'new_problems' ) { - $state = 'confirmed'; + @state = FixMyStreet::DB::Result::Problem->open_states(); $date_col = 'created'; } elsif ( $type eq 'fixed_problems' ) { - $state = 'fixed'; + @state = FixMyStreet::DB::Result::Problem->fixed_states(); $date_col = 'lastupdate'; } @@ -85,7 +85,7 @@ sub problems : Local { '>=' => $start_dt, '<=' => $end_dt + $one_day, }, - state => $state, + state => [ @state ], }, { order_by => { -asc => 'confirmed' }, columns => [ diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 2f895015b..fc8c4cd0e 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -357,7 +357,8 @@ sub add_row { push @{$fixed->{$council}{$duration_str}}, $problem if exists FixMyStreet::DB::Result::Problem->fixed_states()->{$problem->{state}}; # Open problems are either unknown, older, or new - push @{$open->{$council}{$type}}, $problem if $problem->{state} eq 'confirmed'; + push @{$open->{$council}{$type}}, $problem if + exists FixMyStreet::DB::Result::Problem->open_states->{$problem->{state}}; } =head1 AUTHOR diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 9019568f8..9b90b4e11 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -822,8 +822,9 @@ sub generate_problem_banner { my ( $self, $problem ) = @_; my $banner = {}; - if ($problem->state eq 'confirmed' && time() - $problem->lastupdate_local->epoch > 8*7*24*60*60) { - $banner->{id} = 'unknown'; + if ( $problem->is_open && time() - $problem->lastupdate_local->epoch > 8 * 7 * 24 * 60 * 60 ) + { + $banner->{id} = 'unknown'; $banner->{text} = _('This problem is old and of unknown status.'); } if ($problem->is_fixed) { |