diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-12-21 11:13:25 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-12-21 11:13:25 +0000 |
commit | 2551905e74d26188c61f92323560910238c5dfe8 (patch) | |
tree | 386c6818a490044df7b146e5559266718b28f6a4 | |
parent | 327397be805b01eb182cb4605e6386b2e3ec9b05 (diff) |
Front page ignoring unconfirmed, but ordering including null confirmeds.
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index db563e414..a694c45f2 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -84,15 +84,17 @@ sub _recent { my $key = $photos ? 'recent_photos' : 'recent'; $key .= ":$site_key:$num"; + # unconfirmed might be returned for e.g. Zurich, but would mean in moderation, so no photo + my @states = grep { $_ ne 'unconfirmed' } FixMyStreet::DB::Result::Problem->visible_states(); my $query = { non_public => 0, - state => [ FixMyStreet::DB::Result::Problem->visible_states() ], + state => \@states, }; $query->{photo} = { '!=', undef } if $photos; my $attrs = { columns => [ 'id', 'title', 'created', 'confirmed', 'state' ], - order_by => { -desc => 'confirmed' }, + order_by => { -desc => 'coalesce(confirmed, created)' }, rows => $num, }; |