fix(watchlist): TV country full name + tmdb_rating precision rounding
TMDB's origin_country returns ISO codes (KR), not full names, causing a vault regression from South Korea to KR. buildRecord now prefers production_countries[0].name, falling back to the raw origin_country code only when absent. TMDB also now returns vote_average at full precision (6.537), causing mass diff noise against the vault's 1-decimal convention and spurious rewrites on precision drift alone. tmdb_rating is now rounded to 1 decimal place. Loki fixture updated to realistic TMDB shapes (ISO country code + production_countries) to catch this regression going forward.
This commit is contained in:
parent
fb3f52e4b0
commit
e0e0462836
3 changed files with 38 additions and 4 deletions
|
|
@ -117,8 +117,9 @@ export function buildRecord(details: TmdbDetail, isMovie: boolean, prev: Record<
|
|||
runtime = rt.length > 0 ? rt[0] : null;
|
||||
status = details.status ?? '';
|
||||
contentRating = usCertFromContentRatings(details.content_ratings ?? {});
|
||||
const countries: string[] = details.origin_country ?? [];
|
||||
country = countries[0] ?? '';
|
||||
const prodCountries: any[] = details.production_countries ?? [];
|
||||
const originCountries: string[] = details.origin_country ?? [];
|
||||
country = prodCountries[0]?.name ?? originCountries[0] ?? '';
|
||||
seasons = details.number_of_seasons ?? null;
|
||||
episodes = details.number_of_episodes ?? null;
|
||||
vod = (details.networks ?? []).map((n: any) => n.name);
|
||||
|
|
@ -166,7 +167,7 @@ export function buildRecord(details: TmdbDetail, isMovie: boolean, prev: Record<
|
|||
watchStatus, rating, ratingStars,
|
||||
year: yearDisp, runtime, seasons, episodes, vod, genre: genres, status,
|
||||
language, country, director, writer, producer, contentRating,
|
||||
tmdbRating: details.vote_average ?? null, tmdbId: String(details.id),
|
||||
tmdbRating: details.vote_average != null ? Math.round(details.vote_average * 10) / 10 : null, tmdbId: String(details.id),
|
||||
imdbId, releaseDate, lastAirDate, nextAirDate, lastEpisode, upcomingEpisode: upEpisode,
|
||||
poster, trailer, homepage: details.homepage ?? '',
|
||||
imdbPage: imdbId ? `https://www.imdb.com/title/${imdbId}/` : '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue