From 07a7266358c7bdaa564d35b614f8b8a84683e628 Mon Sep 17 00:00:00 2001 From: Benedict Börger Date: Mon, 15 Apr 2019 22:23:48 +0200 Subject: [banking] add grouFile paramter to asset.ini --- src/banking/account.rs | 7 ++++--- src/banking/asset.rs | 10 +++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/banking') diff --git a/src/banking/account.rs b/src/banking/account.rs index 6994bb4..1783e63 100644 --- a/src/banking/account.rs +++ b/src/banking/account.rs @@ -4,11 +4,12 @@ pub struct Account { pub name : String, pub iban : String, pub transactions : Vec, - pub institute : String + pub institute : String, + pub groupFile : String } impl Account { - pub fn new(name : String, iban : String, transactions : Vec, institute : String) -> Account { + pub fn new(name : String, iban : String, transactions : Vec, institute : String, groupFile : String) -> Account { let mut trans = Vec::new(); if institute == "Sparkasse" { // TODO als function/lambda übergeben die konvertierung.. @@ -22,7 +23,7 @@ impl Account { } } } - Account { name : name, iban : iban, transactions : trans, institute : institute } + Account { name : name, iban : iban, transactions : trans, institute : institute, groupFile : groupFile } } } diff --git a/src/banking/asset.rs b/src/banking/asset.rs index 7b7287b..1cbcbc4 100644 --- a/src/banking/asset.rs +++ b/src/banking/asset.rs @@ -39,7 +39,15 @@ impl Asset { if let Some(i) = tmp.get(0) { iban = i.to_string(); } - accounts.push(Account::new(account_name, iban, trans_files.to_vec(), institute)); + match config.get("GroupFile") { + Some(i) => tmp = i, + None => println!("no groupfile for account {}", account_name) + } + let mut groupFile = String::from(""); + if let Some(i) = tmp.get(0) { + groupFile = i.to_string(); + } + accounts.push(Account::new(account_name, iban, trans_files.to_vec(), institute, groupFile)); } -- cgit v1.2.3-70-g09d2