lib,cli,ui,bin: Remove unnecessary normalisedMixedAmount, replace
normaliseMixedAmountSquashPricesForDisplay with mixedAmountStripPrices.
This commit is contained in:
		
							parent
							
								
									4780a02e5a
								
							
						
					
					
						commit
						7cb621b82f
					
				| @ -225,7 +225,7 @@ checkAssertion accounts = checkAssertion' | |||||||
|     -- information, and sort by commodity name. |     -- information, and sort by commodity name. | ||||||
|     fixup m1 m2 = |     fixup m1 m2 = | ||||||
|       let m = H.mixed $ amounts m1 ++ [m_ { H.aquantity = 0 } | m_ <- amounts m2] |       let m = H.mixed $ amounts m1 ++ [m_ { H.aquantity = 0 } | m_ <- amounts m2] | ||||||
|           as = amounts $ H.normaliseMixedAmount m |           as = amounts m | ||||||
|       in H.mixed $ sortOn H.acommodity . map (\a -> a { H.astyle = H.amountstyle }) $ as |       in H.mixed $ sortOn H.acommodity . map (\a -> a { H.astyle = H.amountstyle }) $ as | ||||||
| 
 | 
 | ||||||
| -- | Check if an account name is mentioned in an assertion. | -- | Check if an account name is mentioned in an assertion. | ||||||
|  | |||||||
| @ -208,7 +208,7 @@ sortAccountTreeByAmount normalsign = mapAccounts $ \a -> a{asubs=sortSubs $ asub | |||||||
|     sortSubs = case normalsign of |     sortSubs = case normalsign of | ||||||
|         NormallyPositive -> sortOn (\a -> (Down $ amt a, aname a)) |         NormallyPositive -> sortOn (\a -> (Down $ amt a, aname a)) | ||||||
|         NormallyNegative -> sortOn (\a -> (amt a, aname a)) |         NormallyNegative -> sortOn (\a -> (amt a, aname a)) | ||||||
|     amt = normaliseMixedAmountSquashPricesForDisplay . aibalance |     amt = mixedAmountStripPrices . aibalance | ||||||
| 
 | 
 | ||||||
| -- | Add extra info for this account derived from the Journal's | -- | Add extra info for this account derived from the Journal's | ||||||
| -- account directives, if any (comment, tags, declaration order..). | -- account directives, if any (comment, tags, declaration order..). | ||||||
|  | |||||||
| @ -501,7 +501,7 @@ inferBalancingAmount styles t@Transaction{tpostings=ps} | |||||||
|               -- Inferred amounts are converted to cost. |               -- Inferred amounts are converted to cost. | ||||||
|               -- Also ensure the new amount has the standard style for its commodity |               -- Also ensure the new amount has the standard style for its commodity | ||||||
|               -- (since the main amount styling pass happened before this balancing pass); |               -- (since the main amount styling pass happened before this balancing pass); | ||||||
|               a' = styleMixedAmount styles . normaliseMixedAmount . mixedAmountCost $ maNegate a |               a' = styleMixedAmount styles . mixedAmountCost $ maNegate a | ||||||
| 
 | 
 | ||||||
| -- | Infer prices for this transaction's posting amounts, if needed to make | -- | Infer prices for this transaction's posting amounts, if needed to make | ||||||
| -- the postings balance, and if possible. This is done once for the real | -- the postings balance, and if possible. This is done once for the real | ||||||
|  | |||||||
| @ -280,8 +280,8 @@ budgetReportAsText ropts@ReportOpts{..} budgetr = TB.toLazyText $ | |||||||
|                Nothing |                Nothing | ||||||
|       where |       where | ||||||
|         costedAmounts = case cost_ of |         costedAmounts = case cost_ of | ||||||
|             Cost   -> amounts . mixedAmountCost . normaliseMixedAmount |             Cost   -> amounts . mixedAmountCost | ||||||
|             NoCost -> amounts . normaliseMixedAmount |             NoCost -> amounts | ||||||
| 
 | 
 | ||||||
|     maybetranspose | transpose_ = \(Table rh ch vals) -> Table ch rh (transpose vals) |     maybetranspose | transpose_ = \(Table rh ch vals) -> Table ch rh (transpose vals) | ||||||
|                    | otherwise  = id |                    | otherwise  = id | ||||||
|  | |||||||
| @ -449,7 +449,7 @@ sortRows ropts j | |||||||
|     sortFlatMBRByAmount = case fromMaybe NormallyPositive $ normalbalance_ ropts of |     sortFlatMBRByAmount = case fromMaybe NormallyPositive $ normalbalance_ ropts of | ||||||
|         NormallyPositive -> sortOn (\r -> (Down $ amt r, prrFullName r)) |         NormallyPositive -> sortOn (\r -> (Down $ amt r, prrFullName r)) | ||||||
|         NormallyNegative -> sortOn (\r -> (amt r, prrFullName r)) |         NormallyNegative -> sortOn (\r -> (amt r, prrFullName r)) | ||||||
|       where amt = normaliseMixedAmountSquashPricesForDisplay . prrTotal |       where amt = mixedAmountStripPrices . prrTotal | ||||||
| 
 | 
 | ||||||
|     -- Sort the report rows by account declaration order then account name. |     -- Sort the report rows by account declaration order then account name. | ||||||
|     sortMBRByAccountDeclaration :: [MultiBalanceReportRow] -> [MultiBalanceReportRow] |     sortMBRByAccountDeclaration :: [MultiBalanceReportRow] -> [MultiBalanceReportRow] | ||||||
|  | |||||||
| @ -429,11 +429,7 @@ This implementation turned out to be a bit convoluted but implements the followi | |||||||
| -- The output will be one or more lines depending on the format and number of commodities. | -- The output will be one or more lines depending on the format and number of commodities. | ||||||
| balanceReportItemAsText :: ReportOpts -> BalanceReportItem -> (TB.Builder, [Int]) | balanceReportItemAsText :: ReportOpts -> BalanceReportItem -> (TB.Builder, [Int]) | ||||||
| balanceReportItemAsText opts (_, accountName, depth, amt) = | balanceReportItemAsText opts (_, accountName, depth, amt) = | ||||||
|   renderBalanceReportItem opts ( |   renderBalanceReportItem opts (accountName, depth, amt) | ||||||
|     accountName, |  | ||||||
|     depth, |  | ||||||
|     normaliseMixedAmountSquashPricesForDisplay amt |  | ||||||
|     ) |  | ||||||
| 
 | 
 | ||||||
| -- | Render a balance report item using the given StringFormat, generating one or more lines of text. | -- | Render a balance report item using the given StringFormat, generating one or more lines of text. | ||||||
| renderBalanceReportItem :: ReportOpts -> (AccountName, Int, MixedAmount) -> (TB.Builder, [Int]) | renderBalanceReportItem :: ReportOpts -> (AccountName, Int, MixedAmount) -> (TB.Builder, [Int]) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user