preserve correct file order when using --auto (fixes #949)

And clarify parseAndFinaliseJournal a bit.
This commit is contained in:
Simon Michael 2019-01-15 06:14:47 -08:00
parent a0b0fedd31
commit 228fc9eb3c

View File

@ -264,14 +264,23 @@ parseAndFinaliseJournal parser iopts f txt = do
-- time. If we are only running once, we reorder and follow
-- the options for checking assertions.
let fj = if auto_ iopts && (not . null . jtxnmodifiers) pj
then applyTransactionModifiers <$>
-- with transaction modifiers
then
-- first pass
applyTransactionModifiers <$>
(journalBalanceTransactions False $
-- journalReverse $ -- can skip this one
journalApplyCommodityStyles pj)
-- second pass
>>= (\j ->
journalBalanceTransactions (not $ ignore_assertions_ iopts) $
journalReverse $
journalApplyCommodityStyles pj) >>=
(\j -> journalBalanceTransactions (not $ ignore_assertions_ iopts) $
journalAddFile (f, txt) $
journalSetLastReadTime t $
j)
-- without transaction modifiers
else journalBalanceTransactions (not $ ignore_assertions_ iopts) $
journalReverse $
journalAddFile (f, txt) $