Skip to content

fix: use highest season number for season count - #47

Open
SpackledJim wants to merge 1 commit into
cbackas:mainfrom
SpackledJim:fix/season-count
Open

SpackledJim wants to merge 1 commit into
cbackas:mainfrom
SpackledJim:fix/season-count

Conversation

@SpackledJim

Copy link
Copy Markdown

Show embed "Seasons" field shows the number of season records, not seasons

Commit: 02a3fbe — fix: use highest season number for season count

Cause

buildShowEmbed in src/lib/messages.ts used tvdbSeries.seasons.length. TVDB can return several records per season (one per season type, e.g. official and DVD ordering), so the length can exceed the actual season count.

Fix

value: Math.max(0, ...tvdbSeries.seasons.map((s) => s.number ?? 0)).toFixed(0),
  • Records without a number count as 0.
  • The leading 0 makes an empty list return 0 instead of -Infinity.
  • Specials in season 0 don't affect the count.

The show embed counted the entries in the seasons list, which gave the
wrong number. It now shows the highest season number in that list.
Seasons without a number count as 0, and an empty list shows 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant