more small stuff
This commit is contained in:
parent
0542e2f2f6
commit
dabc30e115
@ -1,5 +1,7 @@
|
|||||||
module Ledger
|
module Ledger
|
||||||
where
|
where
|
||||||
|
import qualified Data.Map as Map
|
||||||
|
|
||||||
import Utils
|
import Utils
|
||||||
import AccountName
|
import AccountName
|
||||||
import BasicTypes
|
import BasicTypes
|
||||||
@ -32,6 +34,9 @@ ledgerTransactionsMatching (acctregexps,descregexps) l =
|
|||||||
(concat [filter (matchTransactionDescription r) ts | r <- descregexps])
|
(concat [filter (matchTransactionDescription r) ts | r <- descregexps])
|
||||||
where ts = ledgerTransactions l
|
where ts = ledgerTransactions l
|
||||||
|
|
||||||
|
ledgerTransactionsInAccount :: Ledger -> AccountName -> [EntryTransaction]
|
||||||
|
ledgerTransactionsInAccount l a = ledgerTransactionsMatching (["^" ++ a ++ "$"], []) l
|
||||||
|
|
||||||
accountNamesFromTransactions :: [EntryTransaction] -> [AccountName]
|
accountNamesFromTransactions :: [EntryTransaction] -> [AccountName]
|
||||||
accountNamesFromTransactions ts = nub $ map account ts
|
accountNamesFromTransactions ts = nub $ map account ts
|
||||||
|
|
||||||
|
|||||||
2
Tests.hs
2
Tests.hs
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
module Tests
|
module Tests
|
||||||
where
|
where
|
||||||
|
import qualified Data.Map as Map
|
||||||
import Text.ParserCombinators.Parsec
|
import Text.ParserCombinators.Parsec
|
||||||
import Test.QuickCheck
|
import Test.QuickCheck
|
||||||
import Test.HUnit
|
import Test.HUnit
|
||||||
@ -219,6 +220,7 @@ ledger7 = Ledger
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
-- utils
|
-- utils
|
||||||
|
|
||||||
assertEqual' e a = assertEqual "" e a
|
assertEqual' e a = assertEqual "" e a
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user