aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-08-01 15:02:49 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-08-01 15:02:49 +0100
commit4844275dfb0155e0870225b928c3238ad9775a7f (patch)
tree0ae49093b3e5fd216601e305f80b28be7babd915
parent3c9c0531e5332c5375f23e9b37fdeb8e5212f019 (diff)
Only fetch child councils - was also including parishes. Fixes #139.
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm10
-rwxr-xr-xtemplates/web/default/reports/council.html2
2 files changed, 7 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 61d7d5cb1..feafc4b77 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -124,7 +124,9 @@ sub ward : Path : Args(2) {
# List of wards
unless ($c->stash->{ward}) {
- my $children = mySociety::MaPit::call('area/children', $c->stash->{council}->{id} );
+ my $children = mySociety::MaPit::call('area/children', $c->stash->{council}->{id},
+ type => $mySociety::VotingArea::council_child_types,
+ );
foreach (values %$children) {
$_->{url} = $c->uri_for( $c->stash->{council_url}
. '/' . $c->cobrand->short_name( $_ )
@@ -269,9 +271,9 @@ sub ward_check : Private {
type => $mySociety::VotingArea::council_child_types,
min_generation => $c->cobrand->area_min_generation
);
- foreach my $id (sort keys %$qw) {
- if ($qw->{$id}->{parent_area} == $council->{id}) {
- $c->stash->{ward} = $qw->{$id};
+ foreach my $area (sort { $a->{name} cmp $b->{name} } values %$qw) {
+ if ($area->{parent_area} == $council->{id}) {
+ $c->stash->{ward} = $area;
return;
}
}
diff --git a/templates/web/default/reports/council.html b/templates/web/default/reports/council.html
index 2b004cf50..0739e84e8 100755
--- a/templates/web/default/reports/council.html
+++ b/templates/web/default/reports/council.html
@@ -23,7 +23,7 @@
<p>[% loc('Follow a ward link to view only reports within that ward.') %]</p>
<ul>
[% FOR child IN children.values.sort('name') %]
-<li><a href="[% child.url %]">[% child.name %]</a></p>
+<li><a href="[% child.url %]">[% child.name %]</a></li>
[% END %]
</ul>
[% END %]