lib: Refactor to eliminate confusing variables.
This commit is contained in:
		
							parent
							
								
									4cd3ed15a0
								
							
						
					
					
						commit
						c25612b8de
					
				| @ -339,17 +339,17 @@ accumValueAmounts :: ReportOpts -> (Day -> MixedAmount -> MixedAmount) -> [DateS | |||||||
|                   -> HashMap ClippedAccountName (Map DateSpan Account) |                   -> HashMap ClippedAccountName (Map DateSpan Account) | ||||||
|                   -> HashMap ClippedAccountName (Map DateSpan Account) |                   -> HashMap ClippedAccountName (Map DateSpan Account) | ||||||
| accumValueAmounts ropts valuation colspans startbals acctchanges =  -- PARTIAL: | accumValueAmounts ropts valuation colspans startbals acctchanges =  -- PARTIAL: | ||||||
|     HM.mapWithKey rowbals $ acctchanges <> (mempty <$ startbals) |     -- Ensure all columns have entries, including those with starting balances | ||||||
|  |     HM.mapWithKey rowbals $ ((<>zeros) <$> acctchanges) <> (zeros <$ startbals) | ||||||
|   where |   where | ||||||
|     -- The row amounts to be displayed: per-period changes, |     -- The valued row amounts to be displayed: per-period changes, | ||||||
|     -- zero-based cumulative totals, or |     -- zero-based cumulative totals, or | ||||||
|     -- starting-balance-based historical balances. |     -- starting-balance-based historical balances. | ||||||
|     rowbals name changes' = dbg'' "rowbals" $ case balancetype_ ropts of |     rowbals name changes = dbg'' "rowbals" $ case balancetype_ ropts of | ||||||
|         HistoricalBalance -> historical |  | ||||||
|         CumulativeChange  -> cumulative |  | ||||||
|         PeriodChange      -> changeamts |         PeriodChange      -> changeamts | ||||||
|  |         CumulativeChange  -> cumulative | ||||||
|  |         HistoricalBalance -> historical | ||||||
|       where |       where | ||||||
|         -- Calculate the valued balances in each column, ensuring every column has an entry. |  | ||||||
|         historical = cumulativeSum startingBalance |         historical = cumulativeSum startingBalance | ||||||
|         cumulative | fixedValuationDate = cumulativeSum nullacct |         cumulative | fixedValuationDate = cumulativeSum nullacct | ||||||
|                    | otherwise          = fmap (`subtractAcct` valuedStart) historical |                    | otherwise          = fmap (`subtractAcct` valuedStart) historical | ||||||
| @ -372,7 +372,6 @@ accumValueAmounts ropts valuation colspans startbals acctchanges =  -- PARTIAL: | |||||||
|             _                      -> True |             _                      -> True | ||||||
|           where singleperiod = interval_ ropts == NoInterval |           where singleperiod = interval_ ropts == NoInterval | ||||||
| 
 | 
 | ||||||
|         changes = changes' <> zeros |  | ||||||
|         startingBalance = HM.lookupDefault nullacct name startbals |         startingBalance = HM.lookupDefault nullacct name startbals | ||||||
|         valuedStart = valueAcct (DateSpan Nothing historicalDate) startingBalance |         valuedStart = valueAcct (DateSpan Nothing historicalDate) startingBalance | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user