;ui: refactor, simplify query

This commit is contained in:
Simon Michael 2020-12-12 11:51:58 -08:00
parent 481c40ca2f
commit 6158d16443
2 changed files with 7 additions and 5 deletions

View File

@ -54,8 +54,7 @@ main = do
opts@UIOpts{cliopts_=copts@CliOpts{inputopts_=_iopts,reportspec_=rspec@ReportSpec{rsOpts=ropts},rawopts_=rawopts}} <- getHledgerUIOpts
-- when (debug_ $ cliopts_ opts) $ printf "%s\n" prognameandversion >> printf "opts: %s\n" (show opts)
-- always include forecasted periodic transactions when loading data;
-- they will be toggled on and off in the UI.
-- always generate forecasted periodic transactions; their visibility will be toggled by the UI.
let copts' = copts{reportspec_=rspec{rsOpts=ropts{forecast_=Just $ fromMaybe nulldatespan (forecast_ ropts)}}}
case True of

View File

@ -66,8 +66,10 @@ rsInit d reset ui@UIState{aopts=_uopts@UIOpts{cliopts_=CliOpts{reportspec_=rspec
-- XXX temp
inclusive = tree_ ropts || rsForceInclusive
thisacctq = Acct $ (if inclusive then accountNameToAccountRegex else accountNameToAccountOnlyRegex) rsAccount
rspec' = rspec{rsOpts=ropts{depth_=Nothing}}
q = And [rsQuery rspec, periodq, excludeforecastq (forecast_ ropts)]
-- Further restrict the query based on the current period and future/forecast mode.
q = simplifyQuery $ And [rsQuery rspec, periodq, excludeforecastq (forecast_ ropts)]
where
periodq = Date $ periodAsDateSpan $ period_ ropts
-- Except in forecast mode, exclude future/forecast transactions.
@ -98,8 +100,9 @@ rsInit d reset ui@UIState{aopts=_uopts@UIOpts{cliopts_=CliOpts{reportspec_=rspec
,rsItemBalanceAmount = showMixedOneLine showAmountWithoutPrice Nothing (Just 32) False bal
,rsItemTransaction = t
}
-- blank items are added to allow more control of scroll position; we won't allow movement over these
blankitems = replicate 100 -- 100 ought to be enough for anyone
-- blank items are added to allow more control of scroll position; we won't allow movement over these.
-- XXX Ugly. Changing to 0 helps when debugging.
blankitems = replicate 100 -- "100 ought to be enough for anyone"
RegisterScreenItem{rsItemDate = ""
,rsItemStatus = Unmarked
,rsItemDescription = ""