diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 93af3393c..0a4ae4609 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -338,7 +338,7 @@ sub load_and_group_problems : Private { $where, { columns => [ - 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', + 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', { duration => { extract => "epoch from current_timestamp-lastupdate" } }, { age => { extract => "epoch from current_timestamp-confirmed" } }, ], @@ -349,11 +349,17 @@ sub load_and_group_problems : Private { $c->stash->{pager} = $problems->pager; $problems = $problems->cursor; # Raw DB cursor for speed - my ( %fixed, %open, @pins ); + my ( %fixed, %open, @pins, $total, $cobrand_total ); my $re_councils = join('|', keys %{$c->stash->{areas_info}}); - my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'duration', 'age' ); + my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'duration', 'age' ); while ( my @problem = $problems->next ) { my %problem = zip @cols, @problem; + $c->log->debug( $problem{'cobrand'} . ', cobrand is ' . $c->cobrand->moniker ); + if ( $problem{'cobrand'} && $problem{'cobrand'} eq $c->cobrand->moniker ) { + $cobrand_total++; + } else { + $total++; + } if ( !$problem{council} ) { # Problem was not sent to any council, add to possible councils $problem{councils} = 0; @@ -372,10 +378,12 @@ sub load_and_group_problems : Private { } } - $c->stash( - fixed => \%fixed, - open => \%open, - pins => \@pins, + $c->stash( + fixed => \%fixed, + open => \%open, + pins => \@pins, + cobrand_count => $cobrand_total || 0, + total_count => $total || 0, ); return 1; |