Sorted Series Printing
This commit is contained in:
parent
173a93280e
commit
67e02e79fd
1 changed files with 8 additions and 3 deletions
|
@ -4,6 +4,7 @@ use chrono::{Duration, Utc};
|
|||
use tokio::sync::{RwLock, RwLockReadGuard};
|
||||
use tokio::time::sleep;
|
||||
use crate::{SharedData};
|
||||
use crate::post_history::{PostHistory, PostHistoryInner};
|
||||
|
||||
pub(crate) async fn run<'a>(shared_data: Arc<RwLock<SharedData>>) {
|
||||
let mut min_len_series: u32 = 0;
|
||||
|
@ -36,7 +37,9 @@ async fn print_info<'a>(data: RwLockReadGuard<'a, SharedData>, min_len_series: &
|
|||
data.config.config_reload_seconds
|
||||
);
|
||||
println!("{:#<1$}", "", separator_width);
|
||||
data.post_history.series.iter().for_each(|(series, post_history)| {
|
||||
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)| {
|
||||
|
||||
if series.len() > local_min_len_series {
|
||||
local_min_len_series = series.len() + 1;
|
||||
|
@ -45,9 +48,11 @@ async fn print_info<'a>(data: RwLockReadGuard<'a, SharedData>, min_len_series: &
|
|||
|
||||
let series_config = data.config.series
|
||||
.iter()
|
||||
.find(|ser| {&ser.slug == series})
|
||||
.find(|ser| {&&ser.slug == series})
|
||||
.expect("Config should not parse without this");
|
||||
post_history.parts.iter().for_each(|(part, part_history)| {
|
||||
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)| {
|
||||
|
||||
if part_history.volume.len() > local_min_len_slug {
|
||||
local_min_len_slug = part_history.chapter.len() + 1;
|
||||
|
|
Loading…
Reference in a new issue