imp: areg: aregister no longer excludes future/forecast transactions by default.

To get the previous behaviour, you can call with the additional query "not📅tomorrow-".

This is because we are preparing to move forecast_ to InputOpts, where
it is not accessible to AccountTransactionsReport.
This commit is contained in:
Stephen Morgan 2021-08-04 11:46:31 +10:00 committed by Simon Michael
parent 23b0cad6ef
commit 5cca04cdc9

View File

@ -29,7 +29,7 @@ import Data.Maybe (catMaybes)
import Data.Ord (Down(..), comparing) import Data.Ord (Down(..), comparing)
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T import qualified Data.Text as T
import Data.Time.Calendar (Day, addDays) import Data.Time.Calendar (Day)
import Hledger.Data import Hledger.Data
import Hledger.Query import Hledger.Query
@ -97,16 +97,10 @@ accountTransactionsReport rspec@ReportSpec{_rsReportOpts=ropts} j thisacctq = it
where where
-- A depth limit should not affect the account transactions report; it should show all transactions in/below this account. -- A depth limit should not affect the account transactions report; it should show all transactions in/below this account.
-- Queries on currency or amount are also ignored at this stage; they are handled earlier, before valuation. -- Queries on currency or amount are also ignored at this stage; they are handled earlier, before valuation.
reportq = simplifyQuery $ And [aregisterq, periodq, excludeforecastq (forecast_ ropts)] reportq = simplifyQuery $ And [aregisterq, periodq]
where where
aregisterq = filterQuery (not . queryIsCurOrAmt) . filterQuery (not . queryIsDepth) $ _rsQuery rspec aregisterq = filterQuery (not . queryIsCurOrAmt) . filterQuery (not . queryIsDepth) $ _rsQuery rspec
periodq = Date . periodAsDateSpan $ period_ ropts periodq = Date . periodAsDateSpan $ period_ ropts
-- Except in forecast mode, exclude future/forecast transactions.
excludeforecastq (Just _) = Any
excludeforecastq Nothing = -- not:date:tomorrow- not:tag:generated-transaction
And [ Not . Date $ DateSpan (Just . addDays 1 $ _rsDay rspec) Nothing
, Not generatedTransactionTag
]
amtq = filterQuery queryIsCurOrAmt $ _rsQuery rspec amtq = filterQuery queryIsCurOrAmt $ _rsQuery rspec
queryIsCurOrAmt q = queryIsSym q || queryIsAmt q queryIsCurOrAmt q = queryIsSym q || queryIsAmt q