areg: ignore a depth limit, as in 1.19 (#1468)
aregister always shows transactions to subaccounts as well, ignoring any depth limit, so that the register's final total matches a corresponding balance report.
This was broken since 2020-09-02 c45663d41.
			
			
This commit is contained in:
		
							parent
							
								
									58df055f7c
								
							
						
					
					
						commit
						08c5857ac9
					
				| @ -83,16 +83,16 @@ aregister opts@CliOpts{rawopts_=rawopts,reportspec_=rspec} j = do | ||||
|     -- gather report options | ||||
|     inclusive = True  -- tree_ ropts | ||||
|     thisacctq = Acct $ (if inclusive then accountNameToAccountRegex else accountNameToAccountOnlyRegex) acct | ||||
|     rspec' = rspec{ rsQuery=simplifyQuery $ And [queryFromFlags ropts, argsquery] | ||||
|                   , rsOpts=ropts' | ||||
|                   } | ||||
|     ropts' = ropts | ||||
|       { -- remove a depth limit for reportq, as in RegisterScreen, I forget why XXX | ||||
|     ropts' = (rsOpts rspec) { | ||||
|         -- ignore any depth limit, as in postingsReport; allows register's total to match balance reports (cf #1468) | ||||
|         depth_=Nothing | ||||
|         -- always show historical balance | ||||
|       , balancetype_= HistoricalBalance | ||||
|       } | ||||
|     ropts = rsOpts rspec | ||||
|     -- and regenerate the ReportSpec, making sure to use the above | ||||
|     rspec' = rspec{ rsQuery=simplifyQuery $ And [queryFromFlags ropts', argsquery] | ||||
|                   , rsOpts=ropts' | ||||
|                   } | ||||
|     reportq = And [rsQuery rspec', excludeforecastq (isJust $ forecast_ ropts')] | ||||
|       where | ||||
|         -- As in RegisterScreen, why ? XXX | ||||
| @ -106,7 +106,7 @@ aregister opts@CliOpts{rawopts_=rawopts,reportspec_=rspec} j = do | ||||
|     -- run the report | ||||
|     -- TODO: need to also pass the queries so we can choose which date to render - move them into the report ? | ||||
|     items = accountTransactionsReport rspec' j reportq thisacctq | ||||
|     items' = (if empty_ ropts then id else filter (not . mixedAmountLooksZero . fifth6)) $ | ||||
|     items' = (if empty_ ropts' then id else filter (not . mixedAmountLooksZero . fifth6)) $ | ||||
|              reverse items | ||||
|     -- select renderer | ||||
|     render | fmt=="txt"  = accountTransactionsReportAsText opts reportq thisacctq | ||||
|  | ||||
| @ -1,16 +1,16 @@ | ||||
| # aregister always includes transactions in subaccounts, ignoring a depth limit #1448 | ||||
| #< | ||||
| #2021-01-01 | ||||
| #  (a)  1 | ||||
| # | ||||
| #2021-01-02 | ||||
| #  (a:aa)  10 | ||||
| # | ||||
| #2021-01-03 | ||||
| #  (a:aa:aaa)  100 | ||||
| # | ||||
| #$ hledger -f- areg a -1 -w80 | ||||
| #Transactions in a and subaccounts: | ||||
| #2021-01-01                      a                                1             1 | ||||
| #2021-01-02                      a:aa                            10            11 | ||||
| #2021-01-03                      a:aa:aaa                       100           111 | ||||
| < | ||||
| 2021-01-01 | ||||
|   (a)  1 | ||||
| 
 | ||||
| 2021-01-02 | ||||
|   (a:aa)  10 | ||||
| 
 | ||||
| 2021-01-03 | ||||
|   (a:aa:aaa)  100 | ||||
| 
 | ||||
| $ hledger -f- areg a -1 -w80 | ||||
| Transactions in a and subaccounts: | ||||
| 2021-01-01                      a                                1             1 | ||||
| 2021-01-02                      a:aa                            10            11 | ||||
| 2021-01-03                      a:aa:aaa                       100           111 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user