Merge branch 'develop'
This commit is contained in:
@@ -327,7 +327,7 @@ pub(in crate::handlers::sonarr_handlers) mod utils {
|
|||||||
title: None,
|
title: None,
|
||||||
season_number: 1,
|
season_number: 1,
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: season_statistics(),
|
statistics: Some(season_statistics()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ pub struct Season {
|
|||||||
#[serde(deserialize_with = "super::from_i64")]
|
#[serde(deserialize_with = "super::from_i64")]
|
||||||
pub season_number: i64,
|
pub season_number: i64,
|
||||||
pub monitored: bool,
|
pub monitored: bool,
|
||||||
pub statistics: SeasonStatistics,
|
pub statistics: Option<SeasonStatistics>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Derivative, Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
#[derive(Derivative, Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
|
||||||
|
|||||||
@@ -5700,7 +5700,7 @@ mod test {
|
|||||||
title: None,
|
title: None,
|
||||||
season_number: 1,
|
season_number: 1,
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: season_statistics(),
|
statistics: Some(season_statistics()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,20 +54,20 @@ mod tests {
|
|||||||
let seasons = vec![
|
let seasons = vec![
|
||||||
Season {
|
Season {
|
||||||
monitored: false,
|
monitored: false,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 1,
|
episode_file_count: 1,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
Season {
|
Season {
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 3,
|
episode_file_count: 3,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -89,20 +89,20 @@ mod tests {
|
|||||||
let seasons = vec![
|
let seasons = vec![
|
||||||
Season {
|
Season {
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 1,
|
episode_file_count: 1,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
Season {
|
Season {
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 3,
|
episode_file_count: 3,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -139,20 +139,20 @@ mod tests {
|
|||||||
let seasons = vec![
|
let seasons = vec![
|
||||||
Season {
|
Season {
|
||||||
monitored: false,
|
monitored: false,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 1,
|
episode_file_count: 1,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
Season {
|
Season {
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 3,
|
episode_file_count: 3,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -174,20 +174,20 @@ mod tests {
|
|||||||
let seasons = vec![
|
let seasons = vec![
|
||||||
Season {
|
Season {
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 1,
|
episode_file_count: 1,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
Season {
|
Season {
|
||||||
monitored: true,
|
monitored: true,
|
||||||
statistics: SeasonStatistics {
|
statistics: Some(SeasonStatistics {
|
||||||
episode_file_count: 3,
|
episode_file_count: 3,
|
||||||
episode_count: 3,
|
episode_count: 3,
|
||||||
..SeasonStatistics::default()
|
..SeasonStatistics::default()
|
||||||
},
|
}),
|
||||||
..Season::default()
|
..Season::default()
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -202,8 +202,19 @@ fn decorate_series_row_with_style<'a>(series: &Series, row: Row<'a>) -> Row<'a>
|
|||||||
return if seasons
|
return if seasons
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|season| season.monitored)
|
.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()
|
row.downloaded()
|
||||||
} else {
|
} else {
|
||||||
row.missing()
|
row.missing()
|
||||||
@@ -217,8 +228,19 @@ fn decorate_series_row_with_style<'a>(series: &Series, row: Row<'a>) -> Row<'a>
|
|||||||
return if seasons
|
return if seasons
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|season| season.monitored)
|
.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()
|
row.unreleased()
|
||||||
} else {
|
} else {
|
||||||
row.missing()
|
row.missing()
|
||||||
|
|||||||
@@ -247,7 +247,11 @@ fn draw_seasons_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
|||||||
size_on_disk,
|
size_on_disk,
|
||||||
next_airing,
|
next_airing,
|
||||||
..
|
..
|
||||||
} = statistics;
|
} = if let Some(stats) = statistics {
|
||||||
|
stats
|
||||||
|
} else {
|
||||||
|
&SeasonStatistics::default()
|
||||||
|
};
|
||||||
let season_monitored = if season.monitored { "🏷" } else { "" };
|
let season_monitored = if season.monitored { "🏷" } else { "" };
|
||||||
let size = convert_to_gb(*size_on_disk);
|
let size = convert_to_gb(*size_on_disk);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user