-
-
Notifications
You must be signed in to change notification settings - Fork 393
expr: OR queries with date: are not handled correctly #2178
Copy link
Copy link
Closed
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.queriesFiltering options, query arguments..Filtering options, query arguments..
Description
Metadata
Metadata
Assignees
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.queriesFiltering options, query arguments..Filtering options, query arguments..
I am trying to use the
balancecommand with anexpr:query that includes adate:term, but I am getting incorrect results.Here's a complete but very minimal example. I have the following journal file (with just one transaction):
and I am running the following command:
As you can see,
balancetakes into account the transaction that occurred on2023-12-22(which is the only transaction in this minimal example), even though it does not match with the date term which isdate:2024-01(i.e. January of 2024). Interestingly enough, if I remove the second operand ofOR, which should have been inconsequential as it is a sub-expression that doesn't match with anything, the problem goes away:This is counterintuitive: mathematically speaking,
<subexpr1>is superset of<subexpr1> OR <subexpr2>, so removing terms from the disjunction should not make the balance smaller, it should only increase it.Note that this problem does not affect
print, asprintseems to pickup the correct transactions. But it does affectregisterand possibly other commands.Finally: