diff options
author | Struan Donald <struan@exo.org.uk> | 2012-04-03 10:37:39 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-04-03 10:37:39 +0100 |
commit | 592924059a07a5a30e8a09dfc4ca8dea56c5c77a (patch) | |
tree | c99e86d3e3f780427bbf7a9ec0ae5187b697dfa5 /bin/update-all-reports | |
parent | 65066d275557e16448aa99ecdfa4df62d4d79649 (diff) | |
parent | d92bbef188eff6c14adf0f0c7b032846b1be85a6 (diff) |
Merge remote-tracking branch 'origin/master' into send-report-rewrite
Conflicts:
bin/send-reports
perllib/FixMyStreet/Cobrand/Default.pm
perllib/FixMyStreet/Cobrand/FixMyStreet.pm
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..4c4838c77 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'; + } } } |