diff options
author | Joris | 2016-06-27 14:36:03 +0200 |
---|---|---|
committer | Joris | 2016-06-27 14:36:03 +0200 |
commit | f605541cbaaa3c339eef8f345547bcd653d3f721 (patch) | |
tree | 1e800df7736e482290ca138726595e067e4a5cf9 /src/client/elm/Model | |
parent | 885dfd7708e338a3220c85b7f22a3ac267aad3f7 (diff) |
Add the edit functionnality on payments
Diffstat (limited to 'src/client/elm/Model')
-rw-r--r-- | src/client/elm/Model/Payment.elm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/elm/Model/Payment.elm b/src/client/elm/Model/Payment.elm index 7e5b37d..b08166e 100644 --- a/src/client/elm/Model/Payment.elm +++ b/src/client/elm/Model/Payment.elm @@ -6,7 +6,8 @@ module Model.Payment exposing , Frequency(..) , paymentsDecoder , paymentIdDecoder - , deletePayment + , edit + , delete , totalPayments , punctual , monthly @@ -70,8 +71,11 @@ frequencyDecoder = _ -> Err ("Could not deduce Punctual nor Monthly from " ++ input) ) -deletePayment : PaymentId -> Payments -> Payments -deletePayment paymentId = List.filter (((/=) paymentId) << .id) +edit : Payment -> Payments -> Payments +edit payment payments = payment :: delete payment.id payments + +delete : PaymentId -> Payments -> Payments +delete paymentId = List.filter (((/=) paymentId) << .id) totalPayments : (Payment -> Bool) -> UserId -> Payments -> Int totalPayments paymentFilter userId payments = |