From 9ec84e3a20c767f6525639f58cd22715e302b88d Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 26 Jun 2016 12:31:24 +0200 Subject: Add an editable date field for punctual payment creation --- src/client/elm/Model/Payment.elm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/client/elm/Model/Payment.elm') diff --git a/src/client/elm/Model/Payment.elm b/src/client/elm/Model/Payment.elm index ab3cbb7..c89e709 100644 --- a/src/client/elm/Model/Payment.elm +++ b/src/client/elm/Model/Payment.elm @@ -33,9 +33,9 @@ type alias Payments = List Payment type alias Payment = { id : PaymentId - , creation : Date , name : String , cost : Int + , date : Date , userId : UserId , frequency : Frequency } @@ -51,9 +51,9 @@ paymentDecoder : Json.Decoder Payment paymentDecoder = Json.object6 Payment ("id" := paymentIdDecoder) - ("creation" := dateDecoder) ("name" := Json.string) ("cost" := Json.int) + ("date" := dateDecoder) ("userId" := userIdDecoder) ("frequency" := frequencyDecoder) @@ -92,7 +92,7 @@ monthly = List.filter ((==) Monthly << .frequency) groupAndSortByMonth : Payments -> List ((Month, Int), Payments) groupAndSortByMonth payments = payments - |> List.groupBy (\payment -> (Date.year payment.creation, monthToInt << Date.month <| payment.creation)) + |> List.groupBy (\payment -> (Date.year payment.date, monthToInt << Date.month <| payment.date)) |> List.sortBy fst |> List.map (\((year, month), payments) -> ((intToMonth month, year), payments)) |> List.reverse @@ -101,7 +101,7 @@ search : String -> Frequency -> Payments -> Payments search name frequency payments = payments |> List.filter ((==) frequency << .frequency) - |> List.sortBy (Date.toTime << .creation) + |> List.sortBy (Date.toTime << .date) |> List.filter (searchSuccess name) |> List.reverse -- cgit v1.2.3