Skip to content

Commit

Permalink
Only use relevant area names in lookup.
Browse files Browse the repository at this point in the history
Prevents error using WMCF name.
  • Loading branch information
dracos committed May 24, 2024
1 parent c36acaf commit dd6c1a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions www/docs/postcode/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,13 @@ function pick_multiple($pc, $areas, $area_type, $house) {
$member_names = \MySociety\TheyWorkForYou\Utility\House::house_to_members($house);
if ($house == HOUSE_TYPE_SCOTLAND) {
$urlp = 'msp';
$a = [ $areas['SPC'], $areas['SPE'] ];
} elseif ($house == HOUSE_TYPE_WALES) {
$urlp = 'ms';
$a = [ $areas['WAC'], $areas['WAE'] ];
} elseif ($house == HOUSE_TYPE_NI) {
$urlp = 'mla';
$a = [ $areas['NIE'] ];
}
$urlpl = $urlp . 's';
$urlp = "/$urlp/?p=";
Expand All @@ -136,8 +139,6 @@ function pick_multiple($pc, $areas, $area_type, $house) {
$mp['standing_down_2024'] = $q['data_value'];
}

$a = array_values($areas);

$query_base = "SELECT member.person_id, given_name, family_name, constituency, house
FROM member, person_names pn
WHERE constituency IN ('" . join("','", $a) . "')
Expand Down

0 comments on commit dd6c1a2

Please sign in to comment.