- Add normalize_to_final_build() to map tune configs to final builds (323/233/332) - Add normalized_config field to BestCarRecord - Change CarCounts.by_rid key from String to (String, String) for per-config tracking - Change CarCounts.guid_to_rid to HashMap<String, HashSet<(String, String)>> - Extract owned tune configs from my_cars.json (engineMajor/weightMajor/chassisMajor) - Add improve command: owned cars not yet at final build, sorted by track count - Strip version prefixes (v2c_/v1c_) from config keys at parse time - Update dedup check in update_best_car to consider normalized_config - Add atomic_write helper for safe CSV output - Delete completed plans/code-review-v2.md - Apply rustfmt formatting across codebase
25 lines
849 B
Rust
25 lines
849 B
Rust
//! Best and very_best command implementations.
|
|
//!
|
|
//! Generates best.csv (all cars best on at least one track) and
|
|
//! very_best.csv (cars best on >= min_count tracks).
|
|
|
|
use top_drives::AppError;
|
|
|
|
use crate::commands::{load_my_cars_or_warn, run_analysis};
|
|
use crate::output::{write_best_csv, write_very_best_csv};
|
|
|
|
/// Executes the best command: generates best.csv and very_best.csv.
|
|
pub async fn run_best(
|
|
my_cars_path: &str,
|
|
cars_db_path: &str,
|
|
times_dir: &str,
|
|
output_dir: &str,
|
|
min_count: usize,
|
|
) -> Result<(), AppError> {
|
|
let my_data = load_my_cars_or_warn(my_cars_path)?;
|
|
let (_ctx, counts) = run_analysis(&my_data, cars_db_path, times_dir).await?;
|
|
write_best_csv(output_dir, &counts)?;
|
|
write_very_best_csv(output_dir, &counts, min_count)?;
|
|
println!("Written: best.csv, very_best.csv");
|
|
Ok(())
|
|
}
|