From dfea6eaee2a1ae353f4fba9225483fa43e22ce5e Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 19 Jan 2023 09:17:56 -1000 Subject: [PATCH] lib: Hledger.Data.Journal: journalAddPricesFromEquity -> journalInferCosts --- hledger-lib/Hledger/Data/Journal.hs | 6 +++--- hledger-lib/Hledger/Read/Common.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 63703d256..3efb0e5f3 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -26,7 +26,7 @@ module Hledger.Data.Journal ( journalCommodityStyles, journalToCost, journalAddInferredEquityPostings, - journalAddPricesFromEquity, + journalInferCosts, journalReverse, journalSetLastReadTime, journalRenumberAccountDeclarations, @@ -881,8 +881,8 @@ journalAddInferredEquityPostings j = journalMapTransactions (transactionAddInfer equityAcct = journalConversionAccount j -- | Add inferred transaction prices from equity postings. -journalAddPricesFromEquity :: Journal -> Either String Journal -journalAddPricesFromEquity j = do +journalInferCosts :: Journal -> Either String Journal +journalInferCosts j = do ts <- mapM (transactionAddPricesFromEquity $ jaccounttypes j) $ jtxns j return j{jtxns=ts} diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index b20faac7f..8685ff9ae 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -324,7 +324,7 @@ journalFinalise iopts@InputOpts{..} f txt pj = do >>= (if auto_ && not (null $ jtxnmodifiers pj) then journalAddAutoPostings _ioDay balancingopts_ -- Add auto postings if enabled, and account tags if needed else pure) - >>= (if infer_costs_ then journalAddPricesFromEquity else pure) -- Add inferred transaction prices from equity postings, if present + >>= (if infer_costs_ then journalInferCosts else pure) -- Add inferred transaction prices from equity postings, if present >>= journalBalanceTransactions balancingopts_ -- Balance all transactions and maybe check balance assertions. <&> (if infer_equity_ then journalAddInferredEquityPostings else id) -- Add inferred equity postings, after balancing and generating auto postings <&> journalInferMarketPricesFromTransactions -- infer market prices from commodity-exchanging transactions