Skip to content

Fix incorrect default seasons - #971

Open
shawnhdx0710 wants to merge 1 commit into
probberechts:masterfrom
shawnhdx0710:fix-default-seasons
Open

shawnhdx0710 wants to merge 1 commit into
probberechts:masterfrom
shawnhdx0710:fix-default-seasons

Conversation

@shawnhdx0710

Copy link
Copy Markdown

Summary

When no seasons are given, a reader defaults to the last 5 seasons. For a multi-year league (Aug-May), the current season ends in the next calendar year. The old code anchored the defaults on the calendar year. From August to December, it skipped the current season. In October 2024, the defaults stopped at 2023/24 and missed 2024/25. This fixes issue #740.

The change also fixes two related problems. The defaults contained 6 seasons, but the log message said 5. Single-year leagues fell one year behind.

What changed

The default-season generation moved to a new _default_seasons(now) method in BaseReader. For a multi-year league, the end year shifts by one when the current month is at or past the season start (usually August). The method now returns exactly 5 seasons. It uses the same range format for both season-code types, so single-year leagues get the correct calendar years.

Tests

Added test_default_seasons. It checks the defaults for multi-year and single-year leagues at different times of the year.

Fixes #740

@shawnhdx0710

Copy link
Copy Markdown
Author

@probberechts

This branch had an error being deployed

1 failed deployment
external — 5c21c879 Deployed Aug 8, 2026 by shawnhdx0710 via Authorize #3234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Common] Incorrect default seasons

1 participant