Merge branch 'develop'

This commit is contained in:
2025-03-10 16:13:48 -06:00
6 changed files with 50 additions and 24 deletions
@@ -327,7 +327,7 @@ pub(in crate::handlers::sonarr_handlers) mod utils {
title: None,
season_number: 1,
monitored: true,
statistics: season_statistics(),
statistics: Some(season_statistics()),
}
}
+1 -1
View File
@@ -288,7 +288,7 @@ pub struct Season {
#[serde(deserialize_with = "super::from_i64")]
pub season_number: i64,
pub monitored: bool,
pub statistics: SeasonStatistics,
pub statistics: Option<SeasonStatistics>,
}
#[derive(Derivative, Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
+1 -1
View File
@@ -5700,7 +5700,7 @@ mod test {
title: None,
season_number: 1,
monitored: true,
statistics: season_statistics(),
statistics: Some(season_statistics()),
}
}
+16 -16
View File
@@ -54,20 +54,20 @@ mod tests {
let seasons = vec![
Season {
monitored: false,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 1,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
Season {
monitored: true,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 3,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
];
@@ -89,20 +89,20 @@ mod tests {
let seasons = vec![
Season {
monitored: true,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 1,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
Season {
monitored: true,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 3,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
];
@@ -139,20 +139,20 @@ mod tests {
let seasons = vec![
Season {
monitored: false,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 1,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
Season {
monitored: true,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 3,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
];
@@ -174,20 +174,20 @@ mod tests {
let seasons = vec![
Season {
monitored: true,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 1,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
Season {
monitored: true,
statistics: SeasonStatistics {
statistics: Some(SeasonStatistics {
episode_file_count: 3,
episode_count: 3,
..SeasonStatistics::default()
},
}),
..Season::default()
},
];
+26 -4
View File
@@ -202,8 +202,19 @@ fn decorate_series_row_with_style<'a>(series: &Series, row: Row<'a>) -> Row<'a>
return if seasons
.iter()
.filter(|season| season.monitored)
.all(|season| season.statistics.episode_file_count == season.statistics.episode_count)
{
.filter(|season| season.statistics.is_some())
.all(|season| {
season
.statistics
.as_ref()
.expect("Season Statistics is undefined")
.episode_file_count
== season
.statistics
.as_ref()
.expect("Season statistics is undefined")
.episode_count
}) {
row.downloaded()
} else {
row.missing()
@@ -217,8 +228,19 @@ fn decorate_series_row_with_style<'a>(series: &Series, row: Row<'a>) -> Row<'a>
return if seasons
.iter()
.filter(|season| season.monitored)
.all(|season| season.statistics.episode_file_count == season.statistics.episode_count)
{
.filter(|season| season.statistics.is_some())
.all(|season| {
season
.statistics
.as_ref()
.expect("Season Statistics is undefined")
.episode_file_count
== season
.statistics
.as_ref()
.expect("Season statistics is undefined")
.episode_count
}) {
row.unreleased()
} else {
row.missing()
@@ -247,7 +247,11 @@ fn draw_seasons_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
size_on_disk,
next_airing,
..
} = statistics;
} = if let Some(stats) = statistics {
stats
} else {
&SeasonStatistics::default()
};
let season_monitored = if season.monitored { "🏷" } else { "" };
let size = convert_to_gb(*size_on_disk);