From 3b738e0d4cc65f314da7389d4542ec826ba0f454 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 5 Sep 2015 13:53:36 +0200 Subject: Using UserId instead of UserName to indentify users --- src/client/Update/Payment.elm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/client/Update') diff --git a/src/client/Update/Payment.elm b/src/client/Update/Payment.elm index b9b60dd..1b43f6f 100644 --- a/src/client/Update/Payment.elm +++ b/src/client/Update/Payment.elm @@ -7,6 +7,7 @@ import Date import Dict import Model exposing (Model) +import Model.User exposing (UserId) import Model.Payment exposing (..) import Model.Payers exposing (..) import Model.View.PaymentView exposing (..) @@ -17,9 +18,9 @@ import Update.Payment.Add exposing (..) type PaymentAction = UpdateAdd AddPaymentAction | UpdatePayments Payments - | AddPayment String Int Payments + | AddPayment UserId Int Payments | ToggleEdit PaymentId - | Remove String Int Payments + | Remove UserId Int Payments | UpdatePage Int Payments updatePayment : Model -> PaymentAction -> PaymentView -> PaymentView @@ -29,20 +30,20 @@ updatePayment model action paymentView = { paymentView | add <- updateAddPayment addPaymentAction paymentView.add } UpdatePayments payments -> { paymentView | payments <- payments } - AddPayment userName cost payments -> + AddPayment userId cost payments -> { paymentView | payments <- payments , currentPage <- 1 , add <- initAddPayment - , payers <- updatePayers paymentView.payers userName cost + , payers <- updatePayers paymentView.payers userId cost , paymentsCount <- paymentView.paymentsCount + 1 } ToggleEdit id -> { paymentView | edition <- if paymentView.edition == Just id then Nothing else Just id } - Remove userName cost payments -> + Remove userId cost payments -> { paymentView | payments <- payments - , payers <- updatePayers paymentView.payers userName -cost + , payers <- updatePayers paymentView.payers userId -cost , paymentsCount <- paymentView.paymentsCount - 1 } UpdatePage page payments -> -- cgit v1.2.3