aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model
diff options
context:
space:
mode:
authorJoris2016-06-27 14:36:03 +0200
committerJoris2016-06-27 14:36:03 +0200
commitf605541cbaaa3c339eef8f345547bcd653d3f721 (patch)
tree1e800df7736e482290ca138726595e067e4a5cf9 /src/client/elm/Model
parent885dfd7708e338a3220c85b7f22a3ac267aad3f7 (diff)
Add the edit functionnality on payments
Diffstat (limited to 'src/client/elm/Model')
-rw-r--r--src/client/elm/Model/Payment.elm10
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 =