From 0c00aa869b70663bcf2f3b1ea123cba586967174 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Sun, 25 Aug 2019 21:04:16 -0400 Subject: [PATCH] moved ImportProcessParameters and LikeKindSettings to core_functions --- src/cli_user_choices.rs | 15 --------------- src/core_functions.rs | 15 ++++++++++++++- src/create_lots_mvmts.rs | 3 +-- src/csv_export.rs | 2 +- src/import_cost_proceeds_etc.rs | 2 +- src/main.rs | 2 +- src/transaction.rs | 2 +- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/cli_user_choices.rs b/src/cli_user_choices.rs index cc799f1..ee3c6d5 100644 --- a/src/cli_user_choices.rs +++ b/src/cli_user_choices.rs @@ -260,18 +260,3 @@ pub fn elect_like_kind_treatment(cutoff_date_arg: &Option) -> (bool, Str } } - -pub struct ImportProcessParameters { - pub export_path: PathBuf, - pub home_currency: String, - pub enable_like_kind_treatment: bool, - pub costing_method: InventoryCostingMethod, - pub lk_cutoff_date_string: String, -} -impl ImportProcessParameters {} - -#[derive(Clone)] -pub struct LikeKindSettings { - pub like_kind_cutoff_date: NaiveDate, - pub like_kind_basis_date_preserved: bool, -} diff --git a/src/core_functions.rs b/src/core_functions.rs index 221c33c..741b30a 100644 --- a/src/core_functions.rs +++ b/src/core_functions.rs @@ -12,7 +12,6 @@ use structopt::StructOpt; use crate::account::{Account, RawAccount, Lot}; use crate::transaction::{Transaction, ActionRecord}; -use crate::cli_user_choices::{ImportProcessParameters, LikeKindSettings}; use crate::import_accts_txns; use crate::import_cost_proceeds_etc; use crate::create_lots_mvmts; @@ -29,6 +28,20 @@ pub enum InventoryCostingMethod { FIFObyLotBasisDate, } +#[derive(Clone)] +pub struct LikeKindSettings { + pub like_kind_cutoff_date: NaiveDate, + pub like_kind_basis_date_preserved: bool, +} + +pub struct ImportProcessParameters { + pub export_path: PathBuf, + pub home_currency: String, + pub enable_like_kind_treatment: bool, + pub costing_method: InventoryCostingMethod, + pub lk_cutoff_date_string: String, +} + pub fn import_and_process_final( input_file_path: PathBuf, settings: &ImportProcessParameters, diff --git a/src/create_lots_mvmts.rs b/src/create_lots_mvmts.rs index 67caff4..41b50d8 100644 --- a/src/create_lots_mvmts.rs +++ b/src/create_lots_mvmts.rs @@ -10,8 +10,7 @@ use chrono::NaiveDate; use crate::transaction::{Transaction, ActionRecord, TxType, Polarity, TxHasMargin}; use crate::account::{Account, RawAccount, Lot, Movement}; -use crate::core_functions::InventoryCostingMethod; -use crate::cli_user_choices::{ImportProcessParameters, LikeKindSettings}; +use crate::core_functions::{InventoryCostingMethod, LikeKindSettings, ImportProcessParameters}; use crate::utils::{round_d128_1e8}; pub fn create_lots_and_movements( diff --git a/src/csv_export.rs b/src/csv_export.rs index 4e4736e..e30e931 100644 --- a/src/csv_export.rs +++ b/src/csv_export.rs @@ -10,7 +10,7 @@ use decimal::d128; use crate::transaction::{Transaction, ActionRecord, Polarity, TxType}; use crate::account::{Account, RawAccount, Term}; -use crate::cli_user_choices::{ImportProcessParameters}; +use crate::core_functions::{ImportProcessParameters}; pub fn _1_account_sums_to_csv( diff --git a/src/import_cost_proceeds_etc.rs b/src/import_cost_proceeds_etc.rs index f79725b..9a0365e 100644 --- a/src/import_cost_proceeds_etc.rs +++ b/src/import_cost_proceeds_etc.rs @@ -9,7 +9,7 @@ use decimal::d128; use crate::transaction::{Transaction, TxType, ActionRecord, Polarity}; use crate::account::{Account, RawAccount}; use crate::utils::{round_d128_1e2}; -use crate::cli_user_choices::{ImportProcessParameters}; +use crate::core_functions::{ImportProcessParameters}; pub fn add_cost_basis_to_movements( settings: &ImportProcessParameters, diff --git a/src/main.rs b/src/main.rs index 700d1da..8a6a00a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,7 +26,7 @@ mod csv_export; mod utils; mod tests; -use crate::cli_user_choices::ImportProcessParameters; +use crate::core_functions::ImportProcessParameters; #[derive(StructOpt, Debug)] diff --git a/src/transaction.rs b/src/transaction.rs index 0d37e9c..7878cc6 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -11,7 +11,7 @@ use decimal::d128; use chrono::NaiveDate; use serde_derive::{Serialize, Deserialize}; -use crate::cli_user_choices::ImportProcessParameters; +use crate::core_functions::ImportProcessParameters; use crate::account::{Account, Movement, RawAccount}; #[derive(Clone, Debug, Serialize, Deserialize)]