Make ECUS importer work
Dependencies
- [2]
PUJBHX7CAdd importer for ECUS transactions
Change contents
- edit in importers/ecus/src/lib.rs at line 21
use time::Date; - replacement in importers/ecus/src/lib.rs at line 66
todo!()Ok(self.config.base_account.clone())}fn date(&self, file: &Utf8Path) -> Option<Result<Date, Self::Error>> {let ecus_transactions = {std::fs::read_to_string(file).into_diagnostic().and_then(|data| {serde_json::from_str::<Vec<EcusTransaction>>(&data).into_diagnostic()})};let ecus_transactions = match ecus_transactions {Ok(data) => data,Err(error) => return Some(Err(error)),};ecus_transactions.into_iter().map(|EcusTransaction { date, .. }| date.date()).max().map(Ok) - edit in importers/ecus/src/lib.rs at line 159
}fn filename(&self, _file: &Utf8Path) -> Option<Result<String, Self::Error>> {Some(Ok(String::from("ecus-transactions.json"))) - replacement in importers/ecus/src/lib.rs at line 165
fn identify(&self, _file: &Utf8Path) -> Result<bool, Self::Error> {Ok(false)fn identify(&self, file: &Utf8Path) -> Result<bool, Self::Error> {let data = std::fs::read_to_string(file).into_diagnostic()?;match serde_json::from_str::<Vec<EcusTransaction>>(&data) {Ok(_) => Ok(true),Err(error) => {tracing::debug!(?error, %file, data, "ignoring file due to deserialization error");Ok(false)}}