print: tag queries will match transactions whose postings contain the tag
This commit is contained in:
parent
d89367d75e
commit
6f49263c9b
@ -147,9 +147,9 @@ postingCleared p = if pstatus p
|
|||||||
postingAllTags :: Posting -> [Tag]
|
postingAllTags :: Posting -> [Tag]
|
||||||
postingAllTags p = ptags p ++ maybe [] transactionAllTags (ptransaction p)
|
postingAllTags p = ptags p ++ maybe [] transactionAllTags (ptransaction p)
|
||||||
|
|
||||||
-- | Tags for this transaction including any inherited from above, when that is implemented.
|
-- | Tags for this transaction including any from its postings.
|
||||||
transactionAllTags :: Transaction -> [Tag]
|
transactionAllTags :: Transaction -> [Tag]
|
||||||
transactionAllTags t = ttags t
|
transactionAllTags t = ttags t ++ concatMap ptags (tpostings t)
|
||||||
|
|
||||||
-- Get the other postings from this posting's transaction.
|
-- Get the other postings from this posting's transaction.
|
||||||
relatedPostings :: Posting -> [Posting]
|
relatedPostings :: Posting -> [Posting]
|
||||||
|
|||||||
@ -631,8 +631,8 @@ tests_matchesTransaction = [
|
|||||||
assertBool "" $ (Desc "x x") `matchesTransaction` nulltransaction{tdescription="x x"}
|
assertBool "" $ (Desc "x x") `matchesTransaction` nulltransaction{tdescription="x x"}
|
||||||
-- see posting for more tag tests
|
-- see posting for more tag tests
|
||||||
assertBool "" $ (Tag "foo" (Just "a")) `matchesTransaction` nulltransaction{ttags=[("foo","bar")]}
|
assertBool "" $ (Tag "foo" (Just "a")) `matchesTransaction` nulltransaction{ttags=[("foo","bar")]}
|
||||||
-- a tag match on a transaction usually ignores posting tags
|
-- a tag match on a transaction also matches posting tags
|
||||||
assertBool "" $ not $ (Tag "postingtag" Nothing) `matchesTransaction` nulltransaction{tpostings=[nullposting{ptags=[("postingtag","")]}]}
|
assertBool "" $ (Tag "postingtag" Nothing) `matchesTransaction` nulltransaction{tpostings=[nullposting{ptags=[("postingtag","")]}]}
|
||||||
]
|
]
|
||||||
|
|
||||||
lookupTagByName :: String -> [Tag] -> Maybe Tag
|
lookupTagByName :: String -> [Tag] -> Maybe Tag
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user