summaryrefslogtreecommitdiff
path: root/src/banking
diff options
context:
space:
mode:
Diffstat (limited to 'src/banking')
-rw-r--r--src/banking/account.rs9
-rw-r--r--src/banking/asset.rs10
2 files changed, 15 insertions, 4 deletions
diff --git a/src/banking/account.rs b/src/banking/account.rs
index 1783e63..baaccec 100644
--- a/src/banking/account.rs
+++ b/src/banking/account.rs
@@ -5,11 +5,13 @@ pub struct Account {
pub iban : String,
pub transactions : Vec<Transaction>,
pub institute : String,
- pub groupFile : String
+ pub groupFile : String,
+ pub category : String
+
}
impl Account {
- pub fn new(name : String, iban : String, transactions : Vec<String>, institute : String, groupFile : String) -> Account {
+ pub fn new(name : String, iban : String, transactions : Vec<String>, institute : String, groupFile : String, category : String) -> Account {
let mut trans = Vec::new();
if institute == "Sparkasse" {
// TODO als function/lambda übergeben die konvertierung..
@@ -23,7 +25,8 @@ impl Account {
}
}
}
- Account { name : name, iban : iban, transactions : trans, institute : institute, groupFile : groupFile }
+ Account { name : name, iban : iban, transactions : trans, institute : institute, groupFile : groupFile, category : category }
+ }
}
}
diff --git a/src/banking/asset.rs b/src/banking/asset.rs
index 1cbcbc4..590d8e7 100644
--- a/src/banking/asset.rs
+++ b/src/banking/asset.rs
@@ -31,6 +31,14 @@ impl Asset {
Some(i) => trans_files = i,
None => panic!("asset: ini file: no \"TransactionFile\" for account: {}", account_name)
}
+ match config.get("Category") {
+ Some(i) => tmp = i,
+ None => panic!("asset: ini file: no \"Category\" for account: {}", account_name)
+ }
+ let mut category = String::from("");
+ if let Some(i) = tmp.get(0) {
+ category = i.to_string();
+ }
match config.get("IBAN") {
Some(i) => tmp = i,
None => panic!("asset: no name for account {}", account_name)
@@ -47,7 +55,7 @@ impl Asset {
if let Some(i) = tmp.get(0) {
groupFile = i.to_string();
}
- accounts.push(Account::new(account_name, iban, trans_files.to_vec(), institute, groupFile));
+ accounts.push(Account::new(account_name, iban, trans_files.to_vec(), institute, groupFile, category));
}