lib: Sorting accounts by amount should also consider account name after amounts.
This commit is contained in:
		
							parent
							
								
									e5a236e9dc
								
							
						
					
					
						commit
						92645cca14
					
				| @ -203,8 +203,9 @@ sortAccountTreeByAmount :: NormalSign -> Account -> Account | ||||
| sortAccountTreeByAmount normalsign = mapAccounts $ \a -> a{asubs=sortSubs $ asubs a} | ||||
|   where | ||||
|     sortSubs = case normalsign of | ||||
|         NormallyPositive -> sortOn (Down . normaliseMixedAmountSquashPricesForDisplay . aibalance) | ||||
|         NormallyNegative -> sortOn (       normaliseMixedAmountSquashPricesForDisplay . aibalance) | ||||
|         NormallyPositive -> sortOn (\a -> (Down $ amt a, aname a)) | ||||
|         NormallyNegative -> sortOn (\a -> (amt a, aname a)) | ||||
|     amt = normaliseMixedAmountSquashPricesForDisplay . aibalance | ||||
| 
 | ||||
| -- | Add extra info for this account derived from the Journal's | ||||
| -- account directives, if any (comment, tags, declaration order..). | ||||
|  | ||||
| @ -528,9 +528,9 @@ sortRows ropts j | ||||
| 
 | ||||
|     -- Sort the report rows, representing a flat account list, by row total. | ||||
|     sortFlatMBRByAmount :: [MultiBalanceReportRow] -> [MultiBalanceReportRow] | ||||
|     sortFlatMBRByAmount = case normalbalance_ ropts of | ||||
|         Just NormallyNegative -> sortOn amt | ||||
|         _                     -> sortOn (Down . amt) | ||||
|     sortFlatMBRByAmount = case fromMaybe NormallyPositive $ normalbalance_ ropts of | ||||
|         NormallyPositive -> sortOn (\r -> (Down $ amt r, prrFullName r)) | ||||
|         NormallyNegative -> sortOn (\r -> (amt r, prrFullName r)) | ||||
|       where amt = normaliseMixedAmountSquashPricesForDisplay . prrTotal | ||||
| 
 | ||||
|     -- Sort the report rows by account declaration order then account name. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user