aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm15
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm12
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm4
6 files changed, 28 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index e5e15092f..4410acdd4 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -171,11 +171,16 @@ sub questionnaire : Path('questionnaire') : Args(0) {
$c->forward('check_page_allowed');
my $questionnaires = $c->model('DB::Questionnaire')->search(
- { whenanswered => \'is not null' }, { group_by => [ 'ever_reported' ], select => [ 'ever_reported', { count => 'me.id' } ], as => [qw/reported questionnaire_count/] }
+ { whenanswered => { '!=', undef } },
+ { group_by => [ 'ever_reported' ],
+ select => [ 'ever_reported', { count => 'me.id' } ],
+ as => [ qw/reported questionnaire_count/ ] }
);
-
- my %questionnaire_counts = map { ( $_->get_column( 'reported' ) || -1 ) => $_->get_column( 'questionnaire_count' ) } $questionnaires->all;
+ my %questionnaire_counts = map {
+ ( defined $_->get_column( 'reported' ) ? $_->get_column( 'reported' ) : -1 )
+ => $_->get_column( 'questionnaire_count' )
+ } $questionnaires->all;
$questionnaire_counts{1} ||= 0;
$questionnaire_counts{0} ||= 0;
$questionnaire_counts{total} = $questionnaire_counts{0} + $questionnaire_counts{1};
@@ -204,6 +209,7 @@ sub council_list : Path('council_list') : Args(0) {
undef,
{
select => [ 'editor', { count => 'contacts_history_id', -as => 'c' } ],
+ as => [ 'editor', 'c' ],
group_by => ['editor'],
order_by => { -desc => 'c' }
}
@@ -211,7 +217,8 @@ sub council_list : Path('council_list') : Args(0) {
$c->stash->{edit_activity} = $edit_activity;
- my @area_types = $c->cobrand->area_types;
+ # Not London, as treated separately
+ my @area_types = grep { $_ ne 'LBO' } $c->cobrand->area_types;
my $areas = mySociety::MaPit::call('areas', \@area_types);
my @councils_ids = sort { strcoll($areas->{$a}->{name}, $areas->{$b}->{name}) } keys %$areas;
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index d3a4500c6..72d6ac62b 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -235,7 +235,7 @@ the map.
sub ajax : Path('/ajax') {
my ( $self, $c ) = @_;
- $c->res->content_type('text/javascript; charset=utf-8');
+ $c->res->content_type('application/json; charset=utf-8');
unless ( $c->req->param('bbox') ) {
$c->res->status(404);
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index 46d7801f6..fe1494b95 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -55,7 +55,7 @@ sub index : Path : Args(0) {
sub old_uri : Regex('^open311\.cgi') : Args(0) {
my ( $self, $c ) = @_;
( my $new = $c->req->path ) =~ s/open311.cgi/open311/;
- $c->res->redirect( "/$new", 301);
+ $c->res->redirect( $c->uri_for("/$new", $c->req->query_params), 301);
}
=head2 discovery
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 3c63d5c07..e84a44dd3 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -674,7 +674,7 @@ sub process_report : Private {
$report->detail( $detail );
# set these straight from the params
- $report->category( _ $params{category} );
+ $report->category( _ $params{category} ) if $params{category};
my $areas = $c->stash->{all_areas};
$report->areas( ',' . join( ',', sort keys %$areas ) . ',' );
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index f7fb5dec5..93af3393c 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -319,8 +319,20 @@ sub load_and_group_problems : Private {
};
if ($c->stash->{ward}) {
$where->{areas} = { 'like', '%,' . $c->stash->{ward}->{id} . ',%' };
+ $where->{council} = [
+ undef,
+ $c->stash->{council}->{id},
+ { 'like', $c->stash->{council}->{id} . ',%' },
+ { 'like', '%,' . $c->stash->{council}->{id} },
+ ];
} elsif ($c->stash->{council}) {
$where->{areas} = { 'like', '%,' . $c->stash->{council}->{id} . ',%' };
+ $where->{council} = [
+ undef,
+ $c->stash->{council}->{id},
+ { 'like', $c->stash->{council}->{id} . ',%' },
+ { 'like', '%,' . $c->stash->{council}->{id} },
+ ];
}
my $problems = $c->cobrand->problems->search(
$where,
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index 767d38c21..23345df65 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -194,7 +194,7 @@ sub generate : Private {
my $out = $c->stash->{rss}->as_string;
my $uri = $c->uri_for( '/' . $c->req->path );
- $out =~ s{<link>(.*?)</link>}{"<link>" . $c->uri_for( $1 ) . "</link><uri>$uri</uri>"}e;
+ $out =~ s{(<link>.*?</link>)}{$1<uri>$uri</uri>};
$c->response->header('Content-Type' => 'application/xml; charset=utf-8');
$c->response->body( $out );
@@ -306,7 +306,7 @@ sub add_parameters : Private {
$c->stash->{rss}->channel(
title => ent($title),
- link => $link . ($c->stash->{qs} || ''),
+ link => $c->uri_for($link) . ($c->stash->{qs} || ''),
description => ent($desc),
language => 'en-gb',
);