dev: note why inferring costs from equity before balancing

This commit is contained in:
Simon Michael 2023-01-19 20:57:02 -10:00
parent 2687b7d7b6
commit 5b27554f0a

View File

@ -325,6 +325,8 @@ journalFinalise iopts@InputOpts{..} f txt pj = do
then journalAddAutoPostings _ioDay balancingopts_ -- Add auto postings if enabled, and account tags if needed then journalAddAutoPostings _ioDay balancingopts_ -- Add auto postings if enabled, and account tags if needed
else pure) else pure)
>>= (if infer_costs_ then journalInferCostsFromEquity else pure) -- Maybe infer costs from equity postings where possible >>= (if infer_costs_ then journalInferCostsFromEquity else pure) -- Maybe infer costs from equity postings where possible
-- XXX ^ You might think this should happen after journalBalanceTransactions, since filling in a missing amount can help
-- infer costs from equity. But currently ignoring excess inferred costs depends somehow on inferring them before balancing.
>>= journalBalanceTransactions balancingopts_ -- Balance all transactions and maybe check balance assertions. >>= journalBalanceTransactions balancingopts_ -- Balance all transactions and maybe check balance assertions.
<&> (if infer_equity_ then journalAddInferredEquityPostings else id) -- Maybe infer equity postings from costs where possible <&> (if infer_equity_ then journalAddInferredEquityPostings else id) -- Maybe infer equity postings from costs where possible
<&> journalInferMarketPricesFromTransactions -- infer market prices from commodity-exchanging transactions <&> journalInferMarketPricesFromTransactions -- infer market prices from commodity-exchanging transactions