rename accounts/filteraccounts fields to accountmap/filteraccountmap
This commit is contained in:
parent
9dc9c9dd76
commit
2cef939da1
@ -87,11 +87,11 @@ filteredaccountnames l = filter (containsRegex (acctpat l) . accountLeafName) $
|
|||||||
|
|
||||||
-- | Get the named account from a ledger.
|
-- | Get the named account from a ledger.
|
||||||
ledgerAccount :: Ledger -> AccountName -> Account
|
ledgerAccount :: Ledger -> AccountName -> Account
|
||||||
ledgerAccount l a = (accounts l) ! a
|
ledgerAccount l a = (accountmap l) ! a
|
||||||
|
|
||||||
-- | Get the named filtered account from a ledger.
|
-- | Get the named filtered account from a ledger.
|
||||||
ledgerFilteredAccount :: Ledger -> AccountName -> Account
|
ledgerFilteredAccount :: Ledger -> AccountName -> Account
|
||||||
ledgerFilteredAccount l a = (filteredaccounts l) ! a
|
ledgerFilteredAccount l a = (filteredaccountmap l) ! a
|
||||||
|
|
||||||
-- | List a ledger's transactions.
|
-- | List a ledger's transactions.
|
||||||
--
|
--
|
||||||
|
|||||||
@ -90,10 +90,10 @@ data Account = Account {
|
|||||||
data Ledger = Ledger {
|
data Ledger = Ledger {
|
||||||
rawledger :: RawLedger,
|
rawledger :: RawLedger,
|
||||||
accountnametree :: Tree AccountName,
|
accountnametree :: Tree AccountName,
|
||||||
accounts :: Map.Map AccountName Account,
|
accountmap :: Map.Map AccountName Account,
|
||||||
lprecision :: Int, -- the preferred display precision
|
lprecision :: Int, -- the preferred display precision
|
||||||
acctpat :: Regex, -- the account patterns used to filter this ledger
|
acctpat :: Regex, -- the account patterns used to filter this ledger
|
||||||
filteredaccountnametree :: Tree AccountName, -- account name tree filtered by acctpat
|
filteredaccountnametree :: Tree AccountName, -- account name tree filtered by acctpat
|
||||||
filteredaccounts :: Map.Map AccountName Account -- accounts filtered by acctpat
|
filteredaccountmap :: Map.Map AccountName Account -- accounts filtered by acctpat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
Tests.hs
2
Tests.hs
@ -84,7 +84,7 @@ tests =
|
|||||||
(accountnames ledger7)
|
(accountnames ledger7)
|
||||||
|
|
||||||
,"cacheLedger" ~: do
|
,"cacheLedger" ~: do
|
||||||
assertequal 15 (length $ Map.keys $ accounts $ cacheLedger wildcard rawledger7 )
|
assertequal 15 (length $ Map.keys $ accountmap $ cacheLedger wildcard rawledger7 )
|
||||||
|
|
||||||
,"showLedgerAccounts" ~: do
|
,"showLedgerAccounts" ~: do
|
||||||
assertequal 4 (length $ lines $ showLedgerAccountBalances ledger7 1)
|
assertequal 4 (length $ lines $ showLedgerAccountBalances ledger7 1)
|
||||||
|
|||||||
2
Utils.hs
2
Utils.hs
@ -55,5 +55,5 @@ myledger = do
|
|||||||
|
|
||||||
-- | get a named account from your ledger file
|
-- | get a named account from your ledger file
|
||||||
myaccount :: AccountName -> IO Account
|
myaccount :: AccountName -> IO Account
|
||||||
myaccount a = myledger >>= (return . fromMaybe nullacct . Map.lookup a . accounts)
|
myaccount a = myledger >>= (return . fromMaybe nullacct . Map.lookup a . accountmap)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user