diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-01-16 15:54:49 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-01-16 15:54:49 +0000 |
commit | cc5a3c97e2d55b573bb44c05e1621dfa5b7c1ce3 (patch) | |
tree | ee9ae7aa7ccf932f472a2574f75b267333fc0b7a | |
parent | 5c1eaa797a7a07656f9ce7031a64d66165ebcc5e (diff) |
Some tweaks to get Zurich Reports page working a bit better.
-rwxr-xr-x | bin/update-all-reports | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/bin/update-all-reports b/bin/update-all-reports index 2ede68fe0..d0146dd47 100755 --- a/bin/update-all-reports +++ b/bin/update-all-reports @@ -59,9 +59,9 @@ while ( my @problem = $problems->next ) { my $type = ( $problem{duration} > 2 * $fourweeks ) ? 'unknown' : ($problem{age} > $fourweeks ? 'older' : 'new'); - if (FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}) { + if (FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}} || FixMyStreet::DB::Result::Problem->closed_states()->{$problem{state}}) { # Fixed problems are either old or new - $fixed{$body}{$duration_str}++ if FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}; + $fixed{$body}{$duration_str}++; } else { # Open problems are either unknown, older, or new $open{$body}{$type}++ if $problem{state} eq 'confirmed'; diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index eab308054..39f9117e8 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -356,9 +356,13 @@ sub load_and_group_problems : Private { # A proxy for an external_body $where->{'lower(external_body)'} = lc $c->stash->{body}->name; } elsif ($c->stash->{body}) { - $where->{areas} = { 'like', '%,' . $c->stash->{body}->id . ',%' }; + # XXX FixMyStreet used to have the following line so that reports not + # currently sent anywhere could still be listed in the appropriate + # (body/area), as they were the same. Now they're not, not sure if + # there's a way to do this easily. + #$where->{areas} = { 'like', '%,' . $c->stash->{body}->id . ',%' }; $where->{bodies_str} = [ - undef, + # undef, $c->stash->{body}->id, { 'like', $c->stash->{body}->id . ',%' }, { 'like', '%,' . $c->stash->{body}->id }, @@ -371,6 +375,7 @@ sub load_and_group_problems : Private { 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', #{ duration => { extract => "epoch from current_timestamp-lastupdate" } }, #{ age => { extract => "epoch from current_timestamp-confirmed" } }, + { created => { extract => 'epoch from created' } }, { confirmed => { extract => 'epoch from confirmed' } }, { whensent => { extract => 'epoch from whensent' } }, { lastupdate => { extract => 'epoch from lastupdate' } }, @@ -384,7 +389,7 @@ sub load_and_group_problems : Private { $problems = $problems->cursor; # Raw DB cursor for speed my ( %problems, @pins ); - my @cols = ( 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'confirmed', 'whensent', 'lastupdate', 'photo', 'extra' ); + my @cols = ( 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'created', 'confirmed', 'whensent', 'lastupdate', 'photo', 'extra' ); while ( my @problem = $problems->next ) { my %problem = zip @cols, @problem; $problem{is_fixed} = FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}; |