Order areas by name in examples

When you click through to the page for a library you see the available
areas in alphabetical order. The examples given for each library should
match this.
This commit is contained in:
Chris Hill-Scott
2020-08-12 12:03:09 +01:00
parent 53fd5b8869
commit dfa2ae0ced
2 changed files with 4 additions and 4 deletions

View File

@@ -121,7 +121,7 @@ class BroadcastAreasRepository(object):
),
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),
description_area_names AS (SELECT name FROM areas ORDER BY name ASC LIMIT 4),
description_areas_joined AS (
SELECT GROUP_CONCAT(name, ", ") FROM description_area_names
)

View File

@@ -51,17 +51,17 @@ def test_examples():
assert countries == 'England, Northern Ireland, Scotland, Wales'
regions = broadcast_area_libraries.get('regions-of-england').get_examples()
assert regions == 'North East, North West, Yorkshire and The Humber, East Midlands, and 5 more…'
assert regions == 'East Midlands, East of England, London, North East, and 5 more…'
counties = broadcast_area_libraries.get(
'counties-and-unitary-authorities-in-england-and-wales',
).get_examples()
assert counties == 'Hartlepool, Middlesbrough, Redcar and Cleveland, Stockton-on-Tees, and 170 more…'
assert counties == 'Barking and Dagenham, Barnet, Barnsley, Bath and North East Somerset, and 170 more…'
wards = broadcast_area_libraries.get(
'electoral-wards-of-the-united-kingdom',
).get_examples()
assert wards == 'Hartlepool, Middlesbrough, Redcar and Cleveland, Stockton-on-Tees, and 375 more…'
assert wards == 'Aberdeen City, Aberdeenshire, Adur, Allerdale, and 375 more…'
@pytest.mark.parametrize('id', (