diff --git a/src/main.rs b/src/main.rs index be87c5a..554808f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,18 +16,16 @@ fn get_job_stats(lodestone_id: usize) -> anyhow::Result> { fn main() -> anyhow::Result<()> { let id = 29932586; let stats = get_job_stats(id)?; - - let total_dowm_earned_levels = stats - .iter() - .filter(|j| matches!(j.role, Role::Tank | Role::Healer | Role::Dps(_))) - .filter(|j| j.name != "Scholar") - .fold(0usize, |acc, j| acc + j.level - j.starting_level); - - println!("{total_dowm_earned_levels} levels for {id}"); + display_stats(id, &stats); let id = 44540671; let stats = get_job_stats(id)?; + display_stats(id, &stats); + Ok(()) +} + +fn display_stats(id: usize, stats: &[JobStats]) { let total_dowm_earned_levels = stats .iter() .filter(|j| matches!(j.role, Role::Tank | Role::Healer | Role::Dps(_))) @@ -35,6 +33,4 @@ fn main() -> anyhow::Result<()> { .fold(0usize, |acc, j| acc + j.level - j.starting_level); println!("{total_dowm_earned_levels} levels for {id}"); - - Ok(()) }