diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 3b64c4343..f31c9a02a 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -642,7 +642,7 @@ journalBalanceTransactionsST assrt j createStore storeIn extract = (storeIn txStore) assrt (Just $ journalCommodityStyles j) - S.empty + (getModifierAccountNames j) flip R.runReaderT env $ do dated <- fmap snd . sortBy (comparing fst) . concat <$> mapM' discriminateByDate (jtxns j) @@ -651,6 +651,14 @@ journalBalanceTransactionsST assrt j createStore storeIn extract = where size = genericLength $ journalPostings j + +-- | Collect account names in account modifiers into a set +getModifierAccountNames :: Journal -> S.Set AccountName +getModifierAccountNames j = S.fromList $ + map paccount $ + concatMap tmpostingrules $ + jtxnmodifiers j + -- | Monad transformer stack with a reference to a mutable hashtable -- of current account balances and a mutable array of finished -- transactions in original parsing order.