diff --git a/src/core/services/anilist/season-resolver.test.ts b/src/core/services/anilist/season-resolver.test.ts index 36d0dcb3..d8061a97 100644 --- a/src/core/services/anilist/season-resolver.test.ts +++ b/src/core/services/anilist/season-resolver.test.ts @@ -623,6 +623,25 @@ test('a sequel naming its own season is not a back half, even with a part synony assert.equal(unnamed.result?.id, 2); }); +test('air order keeps a sequel naming its own season despite a part synonym', () => { + const anchor: AnilistSeasonMedia = { + id: 1, + episodes: 12, + format: 'TV', + seasonYear: 2020, + title: { english: 'Air Order Show' }, + }; + const sequel: AnilistSeasonMedia = { + id: 2, + episodes: 12, + format: 'TV', + seasonYear: 2022, + title: { english: 'Air Order Show Season 2' }, + synonyms: ['Air Order Show Part 2'], + }; + assert.equal(pickByAirOrder(anchor, 2, [anchor, sequel])?.id, 2); +}); + test('a season 1 episode past its length does not move to a longer later season', async () => { const { result } = await resolveInChain( [ diff --git a/src/core/services/anilist/season-resolver.ts b/src/core/services/anilist/season-resolver.ts index 2aeb92ba..425173b6 100644 --- a/src/core/services/anilist/season-resolver.ts +++ b/src/core/services/anilist/season-resolver.ts @@ -620,7 +620,13 @@ export function pickByAirOrder( // spells it " Part 1" is kept. const seasons = franchise.filter((entry) => { if (entry.id === anchor.id) return true; - return !franchise.some((other) => other.id !== entry.id && isSeasonContinuation(other, entry)); + // The anchor is season 1 here, which lets the continuation check reject an entry + // naming another season even when the anchor's own titles name none. + return !franchise.some( + (other) => + other.id !== entry.id && + isSeasonContinuation(other, entry, other.id === anchor.id ? 1 : null), + ); }); if (seasons.length < season) return null;