mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 08:44:23 -04:00
Refactor logic to identify types of areas
I did consider whether to store this explicitly in the SQLite DB, but this is less effort for now and we can always switch to that more robust approach in future if we need to.
This commit is contained in:
@@ -24,7 +24,7 @@ def _convert_custom_areas_to_wards(areas):
|
||||
|
||||
def _aggregate_wards_by_local_authority(areas):
|
||||
return {
|
||||
area.parent if area.id.startswith('wd20-')
|
||||
area.parent if area.is_electoral_ward
|
||||
else area for area in areas
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ def _cluster_lower_tier_authorities(areas):
|
||||
|
||||
for area in areas:
|
||||
# group lower tier authorities by "county"
|
||||
if area.id.startswith('lad20-') and area.parent:
|
||||
if area.is_lower_tier_local_authority:
|
||||
result[area.parent] += [area]
|
||||
# leave countries, unitary authorities as-is
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user