Implement PPQ Calculation [per team per game] and housekeeping.

This commit is contained in:
Cutieguwu
2025-04-05 16:21:31 -04:00
parent 589dbd55d0
commit e72cdbf4b7
12 changed files with 688 additions and 137 deletions

View File

@@ -1,8 +1,6 @@
mod calculator;
use clap::Parser;
use core::panic;
use gamelog::LogFile;
use gamelog::{Flags, LogFile};
use std::path::PathBuf;
#[derive(Debug, Parser)]
@@ -12,7 +10,7 @@ struct Args {
short,
long,
value_hint = clap::ValueHint::DirPath,
default_value = format!("{}/templates/logfile.ron", std::env::current_dir()
default_value = format!("{}/../templates/logfile.ron", std::env::current_dir()
.expect("Failed to get current working dir.")
.into_os_string()
.to_str()
@@ -24,10 +22,22 @@ struct Args {
fn main() {
let config = Args::parse();
let log: LogFile = {
let file = match LogFile::try_from(config.logfile_path) {
Ok(f) => f,
Err(err) => panic!("Error: Failed to open logfile: {:?}", err),
};
let log: LogFile = match LogFile::try_from(config.logfile_path) {
Ok(f) => f,
Err(err) => panic!("Error: Failed to open logfile: {:?}", err),
};
for game in log.0.iter() {
if let Ok(teams) = game.teams() {
for team in teams {
if !game.flags.contains(&Flags::IgnoreTeam(team.to_owned())) {
println!(
"{:?}: {:?}",
&team,
game.avg_plays_per_quarter(team.to_owned())
)
}
}
}
}
}