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.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 =