mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-28 03:12:04 -04:00
Exclude grouped areas from examples
The given examples should match the choices offered when you visit the next page. The choices offered on the next page are either the areas (when a library is not grouped) or the groups (when a library is grouped). This commit makes the examples match the choices by excluding sub-areas, ie those that have a grouping ID.
This commit is contained in:
@@ -114,8 +114,11 @@ class BroadcastAreasRepository(object):
|
||||
def get_library_description(self, library_id):
|
||||
q = """
|
||||
WITH
|
||||
areas AS (SELECT * FROM broadcast_areas
|
||||
WHERE broadcast_area_library_id = ?),
|
||||
areas AS (
|
||||
SELECT * FROM broadcast_areas
|
||||
WHERE broadcast_area_library_id = ?
|
||||
AND broadcast_area_library_group_id IS NULL
|
||||
),
|
||||
area_count AS (SELECT COUNT(*) AS c FROM areas),
|
||||
subset_area_count AS (SELECT c - 4 FROM area_count),
|
||||
description_area_names AS (SELECT name FROM areas LIMIT 4),
|
||||
|
||||
@@ -61,7 +61,7 @@ def test_examples():
|
||||
wards = broadcast_area_libraries.get(
|
||||
'electoral-wards-of-the-united-kingdom',
|
||||
).get_examples()
|
||||
assert wards == 'Abbey, Alibon, Becontree, Chadwell Heath, and 8970 more…'
|
||||
assert wards == 'Hartlepool, Middlesbrough, Redcar and Cleveland, Stockton-on-Tees, and 375 more…'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('id', (
|
||||
|
||||
Reference in New Issue
Block a user