aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Model')
-rw-r--r--src/client/elm/Model/Payment.elm3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/elm/Model/Payment.elm b/src/client/elm/Model/Payment.elm
index 69315a9..013fc95 100644
--- a/src/client/elm/Model/Payment.elm
+++ b/src/client/elm/Model/Payment.elm
@@ -86,9 +86,10 @@ punctual = List.filter ((==) Punctual << .frequency)
monthly : UserId -> Payments -> Payments
monthly userId = List.filter (\p -> p.frequency == Monthly && p.userId == userId)
-groupAndSortByMonth : Payments -> List ((Int, Int), Payments)
+groupAndSortByMonth : Payments -> List ((Month, Int), Payments)
groupAndSortByMonth payments =
payments
|> List.groupBy (\payment -> (Date.year payment.creation, Date.monthToNum << Date.month <| payment.creation))
|> List.sortBy fst
+ |> List.map (\((year, month), payments) -> ((Date.numToMonth month, year), payments))
|> List.reverse