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}
|
sortAccountTreeByAmount normalsign = mapAccounts $ \a -> a{asubs=sortSubs $ asubs a}
|
||||||
where
|
where
|
||||||
sortSubs = case normalsign of
|
sortSubs = case normalsign of
|
||||||
NormallyPositive -> sortOn (Down . normaliseMixedAmountSquashPricesForDisplay . aibalance)
|
NormallyPositive -> sortOn (\a -> (Down $ amt a, aname a))
|
||||||
NormallyNegative -> sortOn ( normaliseMixedAmountSquashPricesForDisplay . aibalance)
|
NormallyNegative -> sortOn (\a -> (amt a, aname a))
|
||||||
|
amt = normaliseMixedAmountSquashPricesForDisplay . 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..).
|
||||||
|
|||||||
@ -528,9 +528,9 @@ sortRows ropts j
|
|||||||
|
|
||||||
-- Sort the report rows, representing a flat account list, by row total.
|
-- Sort the report rows, representing a flat account list, by row total.
|
||||||
sortFlatMBRByAmount :: [MultiBalanceReportRow] -> [MultiBalanceReportRow]
|
sortFlatMBRByAmount :: [MultiBalanceReportRow] -> [MultiBalanceReportRow]
|
||||||
sortFlatMBRByAmount = case normalbalance_ ropts of
|
sortFlatMBRByAmount = case fromMaybe NormallyPositive $ normalbalance_ ropts of
|
||||||
Just NormallyNegative -> sortOn amt
|
NormallyPositive -> sortOn (\r -> (Down $ amt r, prrFullName r))
|
||||||
_ -> sortOn (Down . amt)
|
NormallyNegative -> sortOn (\r -> (amt r, prrFullName r))
|
||||||
where amt = normaliseMixedAmountSquashPricesForDisplay . prrTotal
|
where amt = normaliseMixedAmountSquashPricesForDisplay . prrTotal
|
||||||
|
|
||||||
-- Sort the report rows by account declaration order then account name.
|
-- Sort the report rows by account declaration order then account name.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user