mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-15 13:46:16 -08:00
fix(stalker): keep TMDB genre and country chips on Stalker series (#1930)
The series view re-normalizes the selected item through createStalkerInfo() on every render, and that mapping carried only seven hand-picked tmdb_* fields. tmdb_genres, tmdb_countries, tmdb_media_type and tmdb_supplied_release_date were dropped right after enrichment, so the clickable Discover chips never appeared on Stalker series. The carried keys now come from a Record over StalkerVodInfo's tmdb_* keys, so a new enrichment field fails to compile until it is listed. Saved Stalker entries now also keep tmdb_supplied_release_date, and the recommendations exclusion index (trustedReleaseYear) skips a date TMDB supplied, as the flag's contract requires. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8bf92f9d65
commit
294d630156
9 files changed
+202
-24
No files matched your search
+39
@@ -885,6 +885,45 @@ describe('DashboardRecommendationsService', () => {
|
||||
expect(service.items().map((item) => item.title)).toContain('Godzilla');
|
||||
});
|
||||
|
||||
it('ignores a release date the TMDB merge supplied when excluding', async () => {
|
||||
// The portal sent no date, so the stored one is the year of
|
||||
// whatever TMDB matched. It must not gate the exact tier, or a
|
||||
// namesake match would keep the watched title on the rail.
|
||||
enrichMovie.mockResolvedValue({
|
||||
recommendations: {
|
||||
results: [
|
||||
...recTitles
|
||||
.slice(0, 5)
|
||||
.map((title, i) => rec(100 + i, title)),
|
||||
rec(200, 'Quarry Lights', 2014),
|
||||
],
|
||||
},
|
||||
});
|
||||
recentAll = [
|
||||
...recentVod,
|
||||
{
|
||||
title: 'Quarry Lights',
|
||||
type: 'movie',
|
||||
stalker_item: {
|
||||
id: '9',
|
||||
category_id: 'vod',
|
||||
info: {
|
||||
name: 'Quarry Lights',
|
||||
releasedate: '1954-11-03',
|
||||
tmdb_supplied_release_date: true,
|
||||
},
|
||||
},
|
||||
} as ActivityStub,
|
||||
];
|
||||
const service = createService();
|
||||
|
||||
await service.load();
|
||||
|
||||
expect(service.items().map((item) => item.title)).not.toContain(
|
||||
'Quarry Lights'
|
||||
);
|
||||
});
|
||||
|
||||
it('excludes a watched title whose name ends in a year', async () => {
|
||||
// "Blade Runner 2049" is a 2017 film; the 2049 belongs to the
|
||||
// NAME, so it must not be read as a release year and used to
|
||||
|
||||
@@ -52,7 +52,10 @@ export type RecommendationCandidate = Omit<
|
||||
* gating that key on a title-derived 2049 would fail to exclude the very
|
||||
* film the user just watched (TMDB calls it 2017). Only Stalker rows
|
||||
* carry a real date (`info.releasedate`); everything else yields `null`,
|
||||
* which keeps the exact tier excluding unconditionally.
|
||||
* which keeps the exact tier excluding unconditionally. So does a date the
|
||||
* TMDB merge filled in itself (`tmdb_supplied_release_date`): it is the
|
||||
* year of whatever TMDB matched, and a namesake match would otherwise stop
|
||||
* the watched title from excluding itself.
|
||||
*
|
||||
* The base tier is different by construction — its key exists only
|
||||
* because a trailing year was stripped off — so it keeps using that year.
|
||||
@@ -63,6 +66,9 @@ export function trustedReleaseYear(
|
||||
const info = (
|
||||
item.stalker_item as { info?: Record<string, unknown> } | undefined
|
||||
)?.info;
|
||||
if (info?.['tmdb_supplied_release_date'] === true) {
|
||||
return null;
|
||||
}
|
||||
const releaseDate = info?.['releasedate'];
|
||||
return typeof releaseDate === 'string' ? extractYear(releaseDate) : null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user