lib: journalInferCosts -> journalInferCostsFromEquity

This commit is contained in:
Simon Michael 2023-01-19 20:25:41 -10:00
parent 28eb8be4fa
commit cf469c080d
2 changed files with 6 additions and 6 deletions

View File

@ -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}

View File

@ -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 : ")