fix: Marked the Season.statistics field as Option so that a panic does not happen for outdated Sonarr data. This resolves #35

This commit is contained in:
2025-03-10 16:13:04 -06:00
parent 6d38bc5e1d
commit cab06fe43f
6 changed files with 50 additions and 24 deletions
+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()