diff options
author | Struan Donald <struan@exo.org.uk> | 2011-07-26 16:57:08 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-07-26 16:57:08 +0100 |
commit | 54066cd1387643dd6c6cb3040c520bee66881fd7 (patch) | |
tree | eda84b3f347220ed12de3aa690116148287891bd /perllib/FixMyStreet/App/Controller/JSON.pm | |
parent | 8146bad18eeaab658871dd28eb38199a5d068395 (diff) | |
parent | 198fcef62892fe0b2fbb3ea8a080fca87843445e (diff) |
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Conflicts:
perllib/FixMyStreet/App/Controller/Admin.pm
perllib/FixMyStreet/App/Controller/JSON.pm
perllib/FixMyStreet/Map/Tilma/Original.pm
web/css/core.css
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/JSON.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/JSON.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm index d9baeaaf8..f3607341a 100644 --- a/perllib/FixMyStreet/App/Controller/JSON.pm +++ b/perllib/FixMyStreet/App/Controller/JSON.pm @@ -39,6 +39,7 @@ sub problems : Local { # gather the parameters my $start_date = $c->req->param('start_date') || ''; my $end_date = $c->req->param('end_date') || ''; + my $category = $c->req->param('category') || ''; my $yyyy_mm_dd = qr{^\d{4}-\d\d-\d\d$}; if ( $start_date !~ $yyyy_mm_dd @@ -73,25 +74,29 @@ sub problems : Local { my ( @state, $date_col ); if ( $type eq 'new_problems' ) { @state = FixMyStreet::DB::Result::Problem->open_states(); - $date_col = 'created'; + $date_col = 'confirmed'; } elsif ( $type eq 'fixed_problems' ) { @state = FixMyStreet::DB::Result::Problem->fixed_states(); $date_col = 'lastupdate'; } my $one_day = DateTime::Duration->new( days => 1 ); - my @problems = $c->cobrand->problems->search( { + my $query = { $date_col => { '>=' => $start_dt, '<=' => $end_dt + $one_day, }, state => [ @state ], - }, { + }; + $query->{category} = $category if $category; + my @problems = $c->cobrand->problems->search( $query, { order_by => { -asc => 'confirmed' }, columns => [ 'id', 'title', 'council', 'category', 'detail', 'name', 'anonymous', 'confirmed', 'whensent', 'service', + 'latitude', 'longitude', 'used_map', + 'state', 'lastupdate', ] } ); |