(&mut self, file_names: Vec<String>)
| 416 | } |
| 417 | |
| 418 | async fn process_files(&mut self, file_names: Vec<String>) -> Option<String> { |
| 419 | let mut latest_valid_file_name: Option<String> = None; |
| 420 | if file_names.is_empty() { |
| 421 | // println!("No additional files to process") |
| 422 | } else { |
| 423 | // TODO: can be optimized to fetch all data at once? |
| 424 | for file_name in file_names.iter() { |
| 425 | let (latest_data, _, _) = self.validate_data_by_key(&file_name).await; |
| 426 | |
| 427 | if latest_data.is_some() { |
| 428 | // merge the file if the data is valid |
| 429 | println!("Merging {} data...", { file_name }); |
| 430 | self.merge_data(latest_data.unwrap()); |
| 431 | if latest_valid_file_name.is_none() { |
| 432 | latest_valid_file_name = Some(file_name.clone()); |
| 433 | } |
| 434 | } else { |
| 435 | // skip the file if the data is invalid |
| 436 | println!("Invalid file {}, Skipping...", file_name); |
| 437 | } |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | latest_valid_file_name |
| 442 | } |
| 443 | |
| 444 | async fn fetch_latest_valid_file( |
| 445 | &self, |
nothing calls this directly
no test coverage detected