journal: add new state field for unassignable accounts

This should eventually include accountnames from transaction
modifiers (if `--auto` is enabled), or periodic transactions (if
`--forecast` is enabled).
This commit is contained in:
Jesse Rosenthal 2018-10-18 12:54:55 -04:00 committed by Simon Michael
parent 45b8d4c0de
commit ff455689a3

View File

@ -97,6 +97,7 @@ import Data.Tree
import System.Time (ClockTime(TOD))
import Text.Printf
import qualified Data.Map as M
import qualified Data.Set as S
import Hledger.Utils
import Hledger.Data.Types
@ -641,6 +642,7 @@ journalBalanceTransactionsST assrt j createStore storeIn extract =
(storeIn txStore)
assrt
(Just $ journalCommodityStyles j)
S.empty
flip R.runReaderT env $ do
dated <- fmap snd . sortBy (comparing fst) . concat
<$> mapM' discriminateByDate (jtxns j)
@ -655,10 +657,11 @@ journalBalanceTransactionsST assrt j createStore storeIn extract =
type CurrentBalancesModifier s = R.ReaderT (Env s) (ExceptT String (ST s))
-- | Environment for 'CurrentBalancesModifier'
data Env s = Env { eBalances :: HT.HashTable s AccountName MixedAmount
, eStoreTx :: Transaction -> ST s ()
, eAssrt :: Bool
, eStyles :: Maybe (M.Map CommoditySymbol AmountStyle)
data Env s = Env { eBalances :: HT.HashTable s AccountName MixedAmount
, eStoreTx :: Transaction -> ST s ()
, eAssrt :: Bool
, eStyles :: Maybe (M.Map CommoditySymbol AmountStyle)
, eUnassignable :: S.Set AccountName
}
-- | This converts a transaction into a list of transactions or