Fix batch count showing 0 in generate command output

- Save original batch count before processing loop
- Use saved count in final output message
- Fixes issue #3: 'across 0 batches' bug
This commit is contained in:
2026-04-02 12:50:54 +02:00
parent e9cf2e031f
commit 7c0a61383a

View File

@@ -333,7 +333,8 @@ async fn main() -> anyhow::Result<()> {
clean_csv_file(input_path, &temp_cleaned_path)?; clean_csv_file(input_path, &temp_cleaned_path)?;
let mut batches = read_csv_file_by_batch(&temp_cleaned_path)?; let mut batches = read_csv_file_by_batch(&temp_cleaned_path)?;
println!("Found {} batches in CSV", batches.len()); let batch_count = batches.len();
println!("Found {} batches in CSV", batch_count);
let mut total_customers = 0usize; let mut total_customers = 0usize;
let generated_date = Utc::now().format("%Y-%m-%d %H:%M").to_string(); let generated_date = Utc::now().format("%Y-%m-%d %H:%M").to_string();
@@ -405,7 +406,7 @@ async fn main() -> anyhow::Result<()> {
println!( println!(
"\nGenerated {} customer invoices across {} batches in {:?}", "\nGenerated {} customer invoices across {} batches in {:?}",
total_customers, total_customers,
batches.len(), batch_count,
base_output_dir base_output_dir
); );
} }