Remove smush rules, fix warnings

This commit is contained in:
Piv
2023-03-09 18:58:54 +10:30
parent 540e4c778d
commit 887e7c950b
6 changed files with 23 additions and 84 deletions

View File

@@ -1,7 +1,4 @@
use std::{
collections::{HashMap, HashSet},
thread::current,
};
use std::collections::{HashMap, HashSet};
use itertools::Itertools;
use serde::{Deserialize, Serialize, Serializer};
@@ -26,15 +23,6 @@ struct CsvMovementRule {
dest_from_account: String,
#[serde(rename = "AccountDestTo", default)]
dest_to_account: String,
// TODO: Check how these actually work, they're somehow integrated into other columns
#[serde(default)]
all_from_departments: bool,
#[serde(default)]
all_to_departments: bool,
#[serde(default)]
all_from_accounts: bool,
#[serde(default)]
all_to_accounts: bool,
#[serde(rename = "AmountValue")]
amount: Option<f64>,
#[serde(rename = "AmountType", default)]
@@ -166,7 +154,7 @@ where
)
})
.collect();
let mut accounts_reader = accounts_reader;
let accounts_reader = accounts_reader;
let all_accounts = accounts_reader
.deserialize()
.collect::<Result<Vec<CsvAccount>, csv::Error>>()?;
@@ -203,7 +191,6 @@ where
.unique()
.sorted()
.collect();
let mut rules_reader = rules_reader;
let mut rules: Vec<MovementRule> = vec![];
for movement_rule in rules_reader.deserialize() {
// TODO: Consider reclass rule group, how does that even work?
@@ -375,10 +362,10 @@ pub fn move_money_2(
// to add a new line
let mut running_total = HashMap::from(initial_totals);
let mut temp_total = running_total.clone();
let mut moveMoneyResult: Vec<MoveMoneyResult> = vec![];
let mut move_money_result: Vec<MoveMoneyResult> = vec![];
let mut current_pass = 0;
if flush_pass {
moveMoneyResult.push(MoveMoneyResult {
move_money_result.push(MoveMoneyResult {
pass: current_pass,
totals: running_total.clone(),
})
@@ -388,7 +375,7 @@ pub fn move_money_2(
if flush_pass {
current_pass += 1;
// Flush the totals at the end of this pass (more specifically the change)
moveMoneyResult.push(MoveMoneyResult {
move_money_result.push(MoveMoneyResult {
pass: current_pass,
totals: temp_total
.iter()
@@ -433,12 +420,12 @@ pub fn move_money_2(
}
}
}
moveMoneyResult.push(MoveMoneyResult {
move_money_result.push(MoveMoneyResult {
pass: current_pass,
totals: temp_total,
});
moveMoneyResult
move_money_result
}
#[cfg(test)]
@@ -453,6 +440,7 @@ mod tests {
&mut csv::Writer::from_path("output.csv").unwrap(),
false,
true,
);
)
.unwrap();
}
}