fix header borrow bug

This commit is contained in:
Pakin 2025-08-04 10:56:39 +07:00
parent 6f138d4b98
commit 3d268e6d0a
2 changed files with 12 additions and 4 deletions

View file

@ -50,6 +50,10 @@ impl Table {
.collect::<Vec<String>>();
}
pub fn set_headers(&mut self, headers: Vec<String>) {
self.header = headers;
}
pub fn get_current_header(self) -> Vec<String> {
self.header
}

View file

@ -356,11 +356,15 @@ pub fn generate_recipe_sheet_table(country_name: &str, into_version: usize) {
// auto detect
//
let mut mat_header = Vec::new();
latest_recipe.MaterialSetting.iter().for_each(|ms| {
mat_header.push(ms.id.as_str().unwrap());
});
mat_header.extend(
latest_recipe
.MaterialSetting
.iter()
.map(|ms| ms.id.as_u64().unwrap().to_string())
.collect::<Vec<String>>(),
);
recipe_table.set_header(mat_header);
recipe_table.set_headers(mat_header);
let mut material_names = Vec::new();