diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-06-03 11:50:32 +0100 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-06-03 11:50:32 +0100 |
commit | e8d2fd68b5a594e1f03fc4a4ca338fcd83f16bdf (patch) | |
tree | 923074311986c2108769042d112213a2d19f113a /perllib/FixMyStreet/App/Controller/JSON.pm | |
parent | b712bbffbd70c06c53a1d185462c3419d65069b5 (diff) |
Match the old JSON urls
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/JSON.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/JSON.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm index c437aafc0..d3688f19a 100644 --- a/perllib/FixMyStreet/App/Controller/JSON.pm +++ b/perllib/FixMyStreet/App/Controller/JSON.pm @@ -18,15 +18,24 @@ Provide information as JSON =head1 METHODS -=head2 json +=head2 problems + +Provide JSON of new/fixed problems in a specified time range =cut -sub json : Path : Args(0) { - my ( $self, $c ) = @_; +sub problems : Local { + my ( $self, $c, $path_type ) = @_; + + # get the type from the path - this is to deal with the historic url + # structure. In futur + $path_type ||= ''; + my $type = + $path_type eq 'new' ? 'new_problems' + : $path_type eq 'fixed' ? 'fixed_problems' + : ''; # gather the parameters - my $type = $c->req->param('type') || ''; my $start_date = $c->req->param('start_date') || ''; my $end_date = $c->req->param('end_date') || ''; |