Merge branch 'develop'
This commit is contained in:
@@ -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()
|
||||
},
|
||||
];
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user