aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-05-02 13:20:28 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-05-02 13:20:28 +0100
commit02736ceabebcb6275aa10ceff746bc688733687a (patch)
tree4c16452ab8c4ce46bcebfd52b2b12c7c35f456e2
parente9bd0f0ba61e12c73a5457aa8176d7c505af46da (diff)
Fix for when no results.
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm25
1 files changed, 13 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 55372afb5..14537e5bb 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -540,19 +540,20 @@ sub search_reports : Path('search_reports') {
%{ $site_restriction },
];
}
- my $updates;
- $updates = $c->model('DB::Comment')->search(
- {
- -or => $query,
- },
- {
- -select => [ 'me.*', qw/problem.council problem.state/ ],
- prefetch => [qw/user problem/],
- order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created']
- }
- ) if @$query;
- $c->stash->{updates} = [ $updates->all ];
+ if (@$query) {
+ my $updates = $c->model('DB::Comment')->search(
+ {
+ -or => $query,
+ },
+ {
+ -select => [ 'me.*', qw/problem.council problem.state/ ],
+ prefetch => [qw/user problem/],
+ order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created']
+ }
+ );
+ $c->stash->{updates} = [ $updates->all ];
+ }
# Switch quoting back off. See above for explanation of this.
$c->model('DB')->schema->storage->sql_maker->quote_char( '' );