fix(ees): read the year from suffixed release slugs (review)
A '2025-26-revised' release read as an unknown year went last, behind the '2025-26' release, which then owned the year and dropped every revised row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ae3853277
commit
e09d7a202b
3 files changed
+44
-10
No files matched your search
@@ -76,3 +76,25 @@ def test_only_the_ks4_results_stream_opts_in():
|
||||
opted_in = [chunk.split('(')[0] for chunk in source.split('\nclass ')[1:]
|
||||
if re.search(r'_newest_release_owns_period\s*=\s*True', chunk)]
|
||||
assert opted_in == ['EESKS4PerformanceStream']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('slug, period', [
|
||||
('2024-25', '202425'),
|
||||
('2024-25-revised', '202425'),
|
||||
('2025-26-provisional', '202526'),
|
||||
('latest', None),
|
||||
('', None),
|
||||
])
|
||||
def test_a_release_slug_gives_its_year_whatever_its_suffix(precedence, slug, period):
|
||||
# KS2 already publishes "2024-25-revised" and "2025-26-provisional". An
|
||||
# unread suffix sent the release last, behind the provisional one for the
|
||||
# same year, which then owned the year and dropped every revised row.
|
||||
assert precedence.slug_to_time_period(slug) == period
|
||||
|
||||
|
||||
def test_within_a_year_the_api_order_is_kept(precedence):
|
||||
# The API lists a year's revised release before its first release.
|
||||
releases = [{'id': 'revised', 'time_period': '202526'},
|
||||
{'id': 'first', 'time_period': '202526'},
|
||||
{'id': 'older', 'time_period': '202425'}]
|
||||
assert [r['id'] for r in precedence.newest_first(releases)] == ['revised', 'first', 'older']
|
||||
Reference in new issue
Block a user