parent
dbbf082d5b
commit
82f303f064
|
@ -15,7 +15,7 @@ use rustyline::error::ReadlineError;
|
|||
use rustyline::highlight::{Highlighter};
|
||||
use crate::core_functions::InventoryCostingMethod;
|
||||
|
||||
use crate::utils;
|
||||
use crate::string_utils;
|
||||
|
||||
|
||||
pub fn choose_file_for_import() -> PathBuf {
|
||||
|
@ -194,7 +194,7 @@ pub fn elect_like_kind_treatment(cutoff_date_arg: &Option<String>) -> (bool, Str
|
|||
let mut input = String::new();
|
||||
let stdin = io::stdin();
|
||||
stdin.lock().read_line(&mut input)?;
|
||||
utils::trim_newline(&mut input);
|
||||
string_utils::trim_newline(&mut input);
|
||||
let newly_chosen_date = NaiveDate::parse_from_str(&input, "%y-%m-%d")
|
||||
.unwrap_or(NaiveDate::parse_from_str(&input, "%Y-%m-%d")
|
||||
.expect("Date entered has an incorrect format. Program must abort."));
|
||||
|
@ -236,7 +236,7 @@ pub fn elect_like_kind_treatment(cutoff_date_arg: &Option<String>) -> (bool, Str
|
|||
let mut input = String::new();
|
||||
let stdin = io::stdin();
|
||||
stdin.lock().read_line(&mut input)?;
|
||||
utils::trim_newline(&mut input);
|
||||
string_utils::trim_newline(&mut input);
|
||||
|
||||
let newly_chosen_date = NaiveDate::parse_from_str(&input, "%y-%m-%d")
|
||||
.unwrap_or(NaiveDate::parse_from_str(&input, "%Y-%m-%d")
|
||||
|
|
|
@ -11,7 +11,7 @@ use chrono::NaiveDate;
|
|||
use crate::transaction::{Transaction, ActionRecord, TxType, Polarity, TxHasMargin};
|
||||
use crate::account::{Account, RawAccount, Lot, Movement};
|
||||
use crate::core_functions::{InventoryCostingMethod, LikeKindSettings, ImportProcessParameters};
|
||||
use crate::utils::{round_d128_1e8};
|
||||
use crate::decimal_utils::{round_d128_1e8};
|
||||
|
||||
pub fn create_lots_and_movements(
|
||||
txns_map: HashMap<u32, Transaction>,
|
||||
|
|
|
@ -23,12 +23,3 @@ pub fn round_d128_1e8(to_round: &d128) -> d128 {
|
|||
// As you can see, the quantize is off by one. Quantizing to 10 rounds off the nearest one. Quantizing to 100 rounds off to nearest 10, etc.
|
||||
}
|
||||
|
||||
|
||||
pub fn trim_newline(s: &mut String) {
|
||||
if s.ends_with('\n') {
|
||||
s.pop();
|
||||
if s.ends_with('\r') {
|
||||
s.pop();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ use decimal::d128;
|
|||
|
||||
use crate::transaction::{Transaction, ActionRecord};
|
||||
use crate::account::{Account, RawAccount};
|
||||
use crate::utils::{round_d128_1e8};
|
||||
use crate::decimal_utils::{round_d128_1e8};
|
||||
|
||||
|
||||
pub fn import_accounts(
|
||||
|
|
|
@ -8,7 +8,7 @@ use decimal::d128;
|
|||
|
||||
use crate::transaction::{Transaction, TxType, ActionRecord, Polarity};
|
||||
use crate::account::{Account, RawAccount};
|
||||
use crate::utils::{round_d128_1e2};
|
||||
use crate::decimal_utils::{round_d128_1e2};
|
||||
use crate::core_functions::{ImportProcessParameters};
|
||||
|
||||
pub fn add_cost_basis_to_movements(
|
||||
|
|
|
@ -23,7 +23,8 @@ mod create_lots_mvmts;
|
|||
mod import_cost_proceeds_etc;
|
||||
mod cli_user_choices;
|
||||
mod csv_export;
|
||||
mod utils;
|
||||
mod string_utils;
|
||||
mod decimal_utils;
|
||||
mod tests;
|
||||
|
||||
use crate::core_functions::ImportProcessParameters;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) 2017-2019, scoobybejesus
|
||||
// Redistributions must include the license: https://github.com/scoobybejesus/cryptools-rs/LEGAL.txt
|
||||
|
||||
pub fn trim_newline(s: &mut String) {
|
||||
if s.ends_with('\n') {
|
||||
s.pop();
|
||||
if s.ends_with('\r') {
|
||||
s.pop();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ use decimal::d128;
|
|||
|
||||
use crate::account::{Account};
|
||||
use crate::transaction::{Transaction, ActionRecord};
|
||||
use crate::utils::*;
|
||||
use crate::decimal_utils::*;
|
||||
|
||||
pub fn run_tests(
|
||||
transactions_map: &HashMap<u32, Transaction>,
|
||||
|
|
Loading…
Reference in New Issue