;ui: refactor, simplify query
This commit is contained in:
parent
481c40ca2f
commit
6158d16443
@ -54,8 +54,7 @@ main = do
|
|||||||
opts@UIOpts{cliopts_=copts@CliOpts{inputopts_=_iopts,reportspec_=rspec@ReportSpec{rsOpts=ropts},rawopts_=rawopts}} <- getHledgerUIOpts
|
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)
|
-- when (debug_ $ cliopts_ opts) $ printf "%s\n" prognameandversion >> printf "opts: %s\n" (show opts)
|
||||||
|
|
||||||
-- always include forecasted periodic transactions when loading data;
|
-- always generate forecasted periodic transactions; their visibility will be toggled by the UI.
|
||||||
-- they will be toggled on and off in the UI.
|
|
||||||
let copts' = copts{reportspec_=rspec{rsOpts=ropts{forecast_=Just $ fromMaybe nulldatespan (forecast_ ropts)}}}
|
let copts' = copts{reportspec_=rspec{rsOpts=ropts{forecast_=Just $ fromMaybe nulldatespan (forecast_ ropts)}}}
|
||||||
|
|
||||||
case True of
|
case True of
|
||||||
|
|||||||
@ -66,8 +66,10 @@ rsInit d reset ui@UIState{aopts=_uopts@UIOpts{cliopts_=CliOpts{reportspec_=rspec
|
|||||||
-- XXX temp
|
-- XXX temp
|
||||||
inclusive = tree_ ropts || rsForceInclusive
|
inclusive = tree_ ropts || rsForceInclusive
|
||||||
thisacctq = Acct $ (if inclusive then accountNameToAccountRegex else accountNameToAccountOnlyRegex) rsAccount
|
thisacctq = Acct $ (if inclusive then accountNameToAccountRegex else accountNameToAccountOnlyRegex) rsAccount
|
||||||
|
|
||||||
rspec' = rspec{rsOpts=ropts{depth_=Nothing}}
|
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
|
where
|
||||||
periodq = Date $ periodAsDateSpan $ period_ ropts
|
periodq = Date $ periodAsDateSpan $ period_ ropts
|
||||||
-- Except in forecast mode, exclude future/forecast transactions.
|
-- 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
|
,rsItemBalanceAmount = showMixedOneLine showAmountWithoutPrice Nothing (Just 32) False bal
|
||||||
,rsItemTransaction = t
|
,rsItemTransaction = t
|
||||||
}
|
}
|
||||||
-- blank items are added to allow more control of scroll position; we won't allow movement over these
|
-- 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
|
-- XXX Ugly. Changing to 0 helps when debugging.
|
||||||
|
blankitems = replicate 100 -- "100 ought to be enough for anyone"
|
||||||
RegisterScreenItem{rsItemDate = ""
|
RegisterScreenItem{rsItemDate = ""
|
||||||
,rsItemStatus = Unmarked
|
,rsItemStatus = Unmarked
|
||||||
,rsItemDescription = ""
|
,rsItemDescription = ""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user