diff --git a/hledger-lib/Hledger/Query.hs b/hledger-lib/Hledger/Query.hs index d5c0ab0a0..d57081431 100644 --- a/hledger-lib/Hledger/Query.hs +++ b/hledger-lib/Hledger/Query.hs @@ -155,15 +155,17 @@ data QueryOpt = QueryOptInAcctOnly AccountName -- ^ show an account register fo -- Multiple terms are combined as follows: -- 1. multiple account patterns are OR'd together -- 2. multiple description patterns are OR'd together --- 3. then all terms are AND'd together +-- 3. multiple status patterns are OR'd together +-- 4. then all terms are AND'd together parseQuery :: Day -> T.Text -> (Query,[QueryOpt]) parseQuery d s = (q, opts) where terms = words'' prefixes s (pats, opts) = partitionEithers $ map (parseQueryTerm d) terms (descpats, pats') = partition queryIsDesc pats - (acctpats, otherpats) = partition queryIsAcct pats' - q = simplifyQuery $ And $ [Or acctpats, Or descpats] ++ otherpats + (acctpats, pats'') = partition queryIsAcct pats' + (statuspats, otherpats) = partition queryIsStatus pats'' + q = simplifyQuery $ And $ [Or acctpats, Or descpats, Or statuspats] ++ otherpats tests_parseQuery = [ "parseQuery" ~: do diff --git a/tests/journal/status.test b/tests/journal/status.test index d2295a599..dc141b260 100644 --- a/tests/journal/status.test +++ b/tests/journal/status.test @@ -100,3 +100,16 @@ hledger -fstatus.journal print status: >>>=0 +# 11. multiple status: queries are OR'd +hledger -fstatus.journal print status: status:! +>>> +2017/01/01 uncleared + (a) 1 + (b) 1 + +2017/01/02 ! pending + (a) 1 + ! (b) 1 + +>>>= 0 +