From a94291d5a4a94ecb99c06466e5663dc157c3a36e Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Fri, 27 Aug 2021 14:41:00 +0100 Subject: [PATCH] Clarify comments for aggregation algorithm In response to [1] and [2]. [1]: https://github.com/alphagov/notifications-admin/pull/4003#discussion_r695919270 [2]: https://github.com/alphagov/notifications-admin/pull/4003#discussion_r695920213 --- app/broadcast_areas/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/broadcast_areas/utils.py b/app/broadcast_areas/utils.py index 217bf028e..cd4ec378d 100644 --- a/app/broadcast_areas/utils.py +++ b/app/broadcast_areas/utils.py @@ -34,17 +34,17 @@ def _aggregate_lower_tier_authorities(areas): clusters = _cluster_lower_tier_authorities(areas) for cluster in clusters: - # always keep lone area as itself + # always show a single area cluster as itself (aggregation isn't helpful) if len(cluster) == 1: results |= set(cluster) - # aggregate multi-area cluster + # aggregate a single cluster with lots of areas (too complex to show in full) elif len(cluster) > 3: results |= {cluster[0].parent} - # aggregate many small clusters + # if cluster is 2 or 3 areas, and there are more than 1 cluster, aggregate the cluster elif len(clusters) > 1: area = cluster[0] results |= {area.parent or area} - # keep one small cluster in full + # else keep single 2-3 areas cluster in full (easy enough to understand) else: results |= set(cluster)