From cf469c080de25bd78d1d9fa0506264560c05eaab Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 19 Jan 2023 20:25:41 -1000 Subject: [PATCH] lib: journalInferCosts -> journalInferCostsFromEquity --- hledger-lib/Hledger/Data/Journal.hs | 8 ++++---- hledger-lib/Hledger/Read/Common.hs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 8fcc20cf7..52dedcd8e 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, - journalInferCosts, + journalInferCostsFromEquity, journalReverse, journalSetLastReadTime, journalRenumberAccountDeclarations, @@ -880,10 +880,10 @@ journalAddInferredEquityPostings j = journalMapTransactions (transactionAddInfer where equityAcct = journalConversionAccount j --- | Add costs inferred from equity postings, where needed and possible. +-- | Add costs inferred from equity conversion postings, where needed and possible. -- See hledger manual > Inferring cost from equity postings. -journalInferCosts :: Journal -> Either String Journal -journalInferCosts j = do +journalInferCostsFromEquity :: Journal -> Either String Journal +journalInferCostsFromEquity j = do ts <- mapM (transactionInferCostsFromEquity $ 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 11e8afcfb..f873f63e8 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -324,9 +324,9 @@ 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 journalInferCosts else pure) -- Add inferred transaction prices from equity postings, if present + >>= (if infer_costs_ then journalInferCostsFromEquity else pure) -- Maybe infer costs from equity postings where possible >>= 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 + <&> (if infer_equity_ then journalAddInferredEquityPostings else id) -- Maybe infer equity postings from costs where possible <&> journalInferMarketPricesFromTransactions -- infer market prices from commodity-exchanging transactions <&> traceOrLogAt 6 ("journalFinalise: " <> takeFileName f) -- debug logging <&> dbgJournalAcctDeclOrder ("journalFinalise: " <> takeFileName f <> " acct decls : ")