From d1f122f15e86b4a166c0ef9262ecaf7382c86e4f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 1 Feb 2019 15:30:57 -0800 Subject: [PATCH] refactor: clarify, note issues (#893) --- hledger-lib/Hledger/Read/Common.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index ebe193b8f..c2be1c885 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -255,21 +255,23 @@ parseAndFinaliseJournal parser iopts f txt = do -- the options for checking assertions. let fj = if auto_ iopts && (not . null . jtxnmodifiers) pj - -- with transaction modifiers + -- transaction modifiers are active then - -- first pass - journalModifyTransactions <$> - (journalBalanceTransactions False $ + -- first pass, doing most of the work + ( + (journalModifyTransactions <$>) $ -- add auto postings after balancing ? #893b fails + journalBalanceTransactions False $ + -- journalModifyTransactions <$> -- add auto postings before balancing ? probably #893a, #928, #938 fail journalReverse $ journalAddFile (f, txt) $ journalApplyCommodityStyles pj) - -- second pass + -- second pass, checking balance assertions >>= (\j -> journalBalanceTransactions (not $ ignore_assertions_ iopts) $ journalSetLastReadTime t $ j) - -- without transaction modifiers + -- transaction modifiers are not active else journalBalanceTransactions (not $ ignore_assertions_ iopts) $ journalReverse $ journalAddFile (f, txt) $