fix(meta,api): detail ratings are optional too

This commit is contained in:
Miguel Palhas
2026-08-23 22:26:04 +01:00
parent c9e73cb23c
commit 30382585ea
3 changed files with 15 additions and 7 deletions
+10 -4
View File
@@ -223,7 +223,10 @@ pub struct MovieDetail {
pub genres: Vec<Genre>,
pub backdrop_path: Option<String>,
pub poster_path: Option<String>,
pub vote_average: f64,
/// Zero normalised away, like [`Movie::vote_average`]: TMDB sends `0`
/// where "no votes yet" is meant, and a detail page must not show it as
/// a rating.
pub vote_average: Option<f64>,
pub vote_count: u32,
pub homepage: Option<String>,
pub status: String,
@@ -244,7 +247,10 @@ pub struct SeriesDetail {
pub genres: Vec<Genre>,
pub backdrop_path: Option<String>,
pub poster_path: Option<String>,
pub vote_average: f64,
/// Zero normalised away, like [`Movie::vote_average`]: TMDB sends `0`
/// where "no votes yet" is meant, and a detail page must not show it as
/// a rating.
pub vote_average: Option<f64>,
pub vote_count: u32,
pub homepage: Option<String>,
pub status: String,
@@ -771,7 +777,7 @@ impl From<RawMovieDetail> for MovieDetail {
.collect(),
backdrop_path: non_empty(raw.backdrop_path),
poster_path: non_empty(raw.poster_path),
vote_average: raw.vote_average,
vote_average: rating(raw.vote_average),
vote_count: raw.vote_count,
homepage: non_empty(raw.homepage),
status: raw.status,
@@ -799,7 +805,7 @@ impl From<RawSeriesDetail> for SeriesDetail {
.collect(),
backdrop_path: non_empty(raw.backdrop_path),
poster_path: non_empty(raw.poster_path),
vote_average: raw.vote_average,
vote_average: rating(raw.vote_average),
vote_count: raw.vote_count,
homepage: non_empty(raw.homepage),
status: raw.status,