diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-03-05 14:58:41 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-03-05 14:58:41 +0000 |
commit | 8f28f3a311a57d596f1eaa309d0b8f565fb20e88 (patch) | |
tree | f259ee911b98553cdc19a3a3838e16cf10e29142 /bin/update-all-reports | |
parent | 7725eff6e3216b74f1cd65e1ca9f432e7008e4e3 (diff) |
Fix states lookups in update-all-reports.
Diffstat (limited to 'bin/update-all-reports')
-rwxr-xr-x | bin/update-all-reports | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/update-all-reports b/bin/update-all-reports index c87977f68..794ee5368 100755 --- a/bin/update-all-reports +++ b/bin/update-all-reports @@ -20,7 +20,7 @@ my $fourweeks = 4*7*24*60*60; my $problems = FixMyStreet::App->model("DB::Problem")->search( { - state => [ 'confirmed', 'fixed' ] + state => FixMyStreet::DB::Result::Problem->visible_states(), }, { columns => [ @@ -52,10 +52,13 @@ while ( my @problem = $problems->next ) { my $type = ( $problem{duration} > 2 * $fourweeks ) ? 'unknown' : ($problem{age} > $fourweeks ? 'older' : 'new'); - # Fixed problems are either old or new - $fixed{$council}{$duration_str}++ if $problem{state} eq 'fixed'; - # Open problems are either unknown, older, or new - $open{$council}{$type}++ if $problem{state} eq 'confirmed'; + if (FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}) { + # Fixed problems are either old or new + $fixed{$council}{$duration_str}++ if FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}; + } else { + # Open problems are either unknown, older, or new + $open{$council}{$type}++ if $problem{state} eq 'confirmed'; + } } } |