Fix move money to correctly move between accounts/ccs with ranges and and consider cost output correctly, speed up process by using hashset for rule accounts/departments
This commit is contained in:
14
src/lib.rs
14
src/lib.rs
@@ -22,6 +22,7 @@ pub extern "C" fn move_money_from_text(
|
||||
rules: *const c_char,
|
||||
lines: *const c_char,
|
||||
accounts: *const c_char,
|
||||
cost_centres: *const c_char,
|
||||
use_numeric_accounts: bool,
|
||||
) -> *mut c_char {
|
||||
let mut output_writer = csv::Writer::from_writer(vec![]);
|
||||
@@ -34,13 +35,18 @@ pub extern "C" fn move_money_from_text(
|
||||
CStr::from_ptr(lines)
|
||||
};
|
||||
let safe_accounts = unsafe {
|
||||
assert!(!lines.is_null());
|
||||
assert!(!accounts.is_null());
|
||||
CStr::from_ptr(accounts)
|
||||
};
|
||||
let safe_cost_centres = unsafe {
|
||||
assert!(!cost_centres.is_null());
|
||||
CStr::from_ptr(cost_centres)
|
||||
};
|
||||
move_money(
|
||||
csv::Reader::from_reader(safe_rules.to_bytes()),
|
||||
csv::Reader::from_reader(safe_lines.to_bytes()),
|
||||
csv::Reader::from_reader(safe_accounts.to_bytes()),
|
||||
&mut csv::Reader::from_reader(safe_rules.to_bytes()),
|
||||
&mut csv::Reader::from_reader(safe_lines.to_bytes()),
|
||||
&mut csv::Reader::from_reader(safe_accounts.to_bytes()),
|
||||
&mut csv::Reader::from_reader(safe_cost_centres.to_bytes()),
|
||||
&mut output_writer,
|
||||
use_numeric_accounts,
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user