From 6f138d4b98ae8f4fcfb6a81b9e48c25ca0dfbfab Mon Sep 17 00:00:00 2001 From: Pakin Date: Mon, 4 Aug 2025 10:25:25 +0700 Subject: [PATCH] Update import to auto detect mat instead of fixed array --- src/recipe_functions/import.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/recipe_functions/import.rs b/src/recipe_functions/import.rs index 28c0001..7b66a15 100644 --- a/src/recipe_functions/import.rs +++ b/src/recipe_functions/import.rs @@ -353,17 +353,14 @@ pub fn generate_recipe_sheet_table(country_name: &str, into_version: usize) { recipe_table.set_config(insert_later_config); - match country_name { - "sgp" => { - info!("SGP last update [24.02.2025]"); - recipe_table.set_header(Headers::get_recipe_table_sgp_24022025()); - } - "dubai" => { - info!("UAE last update [16.05.2025]"); - recipe_table.set_header(Headers::get_recipe_table_dubai_16052025()); - } - _ => {} - } + // auto detect + // + let mut mat_header = Vec::new(); + latest_recipe.MaterialSetting.iter().for_each(|ms| { + mat_header.push(ms.id.as_str().unwrap()); + }); + + recipe_table.set_header(mat_header); let mut material_names = Vec::new();