fix(api): specials stay out of episode counters

This commit is contained in:
Miguel Palhas
2026-08-23 16:40:38 +01:00
parent fc93d27f7e
commit 93ccea2de0
2 changed files with 17 additions and 8 deletions
+10 -1
View File
@@ -285,7 +285,16 @@ fn with_status(
episodes: &[arr_core::Episode],
now: SystemTime,
) -> Series {
let wanted = episodes.iter().filter(|episode| episode.wanted);
// §4.2: season 0 is invisible to status, so it stays out of the counters
// too. A series reading `complete` next to `42/52 eps` is the confusion
// this avoids. `UNIQUE (series_id, number)` means there is at most one.
let specials = seasons
.iter()
.find(|season| season.number == 0)
.map(|season| season.id);
let wanted = episodes
.iter()
.filter(|episode| episode.wanted && specials != Some(episode.season_id));
let available = wanted
.clone()
.filter(|episode| episode.state == MediaState::Available);