Fix Bug where series existing in history but not in config crashed the bot
All checks were successful
Run Tests on Code / run-tests (push) Successful in 32s
All checks were successful
Run Tests on Code / run-tests (push) Successful in 32s
This commit is contained in:
parent
2531af3739
commit
c85f761e85
1 changed files with 12 additions and 7 deletions
|
@ -40,20 +40,25 @@ async fn print_info(arc_data: &Arc<RwLock<SharedData>>, min_len_series: &mut u32
|
|||
println!("{:#<1$}", "", separator_width);
|
||||
let mut sorted_series: Vec<(&String, &PostHistory)> = data.post_history.series.iter().collect();
|
||||
sorted_series.sort_by(|(a, _), (b, _)| a.cmp(b));
|
||||
sorted_series.iter().for_each(|(series, post_history)| {
|
||||
for (series, post_history) in sorted_series.iter() {
|
||||
|
||||
if series.len() > local_min_len_series {
|
||||
local_min_len_series = series.len() + 1;
|
||||
*min_len_series = local_min_len_series as u32;
|
||||
}
|
||||
|
||||
let series_config = data.config.series
|
||||
let series_config = match data.config.series
|
||||
.iter()
|
||||
.find(|ser| {&&ser.slug == series})
|
||||
.expect("Config should not parse without this");
|
||||
.find(|ser| {
|
||||
&&ser.slug == series
|
||||
}) {
|
||||
Some(data) => data,
|
||||
None => continue,
|
||||
};
|
||||
|
||||
let mut sorted_parts: Vec<(&String, &PostHistoryInner)> = post_history.parts.iter().collect();
|
||||
sorted_parts.sort_by(|(a, _), (b, _)| a.cmp(b));
|
||||
sorted_parts.iter().for_each(|(part, part_history)| {
|
||||
for (part, part_history) in sorted_parts.iter() {
|
||||
|
||||
if part_history.volume.len() > local_min_len_slug {
|
||||
local_min_len_slug = part_history.chapter.len() + 1;
|
||||
|
@ -82,8 +87,8 @@ async fn print_info(arc_data: &Arc<RwLock<SharedData>>, min_len_series: &mut u32
|
|||
print!("{:<1$}| ", "", local_min_len_slug - part_history.chapter.len());
|
||||
print!("{}", series_config.prepub_community.name);
|
||||
println!("{:<1$}|", "", 20 - series_config.prepub_community.name.len());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
println!("{:#<1$}", "", separator_width);
|
||||
for error in data.get_messages(true, true, false).iter() {
|
||||
println!("{}", error.content());
|
||||
|
|
Loading…
Reference in a new issue