diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-10-23 14:58:30 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-10-23 14:58:30 +0100 |
commit | da52879e407ffa683567e349c744f30171065a76 (patch) | |
tree | 4d02bc41b672de596903d8224894bb10745c7f12 /perllib/FixMyStreet/DB/ResultSet/Comment.pm | |
parent | 239148e9ba1e55ce205f4ec134c0baab104b0208 (diff) | |
parent | af7a602d2c83bdf0371ae253f5ba3f80cece077d (diff) |
Merge branch '1251-json-status-page'
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Comment.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Comment.pm | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Comment.pm b/perllib/FixMyStreet/DB/ResultSet/Comment.pm index 270501efc..1b6afb819 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Comment.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Comment.pm @@ -32,15 +32,16 @@ sub timeline { sub summary_count { my ( $rs, $body_restriction ) = @_; - return $rs->to_body($body_restriction)->search( - undef, - { - group_by => ['me.state'], - select => [ 'me.state', { count => 'me.id' } ], - as => [qw/state state_count/], - join => 'problem' - } - ); + my $params = { + group_by => ['me.state'], + select => [ 'me.state', { count => 'me.id' } ], + as => [qw/state state_count/], + }; + if ($body_restriction) { + $rs = $rs->to_body($body_restriction); + $params->{join} = 'problem'; + } + return $rs->search(undef, $params); } 1; |