From b73ba24f3440b81698c9d5c370739d03f958f059 Mon Sep 17 00:00:00 2001 From: Joris Date: Thu, 31 Dec 2015 19:34:29 +0100 Subject: Fetch all the payments, do the paging only in the UI --- src/client/elm/Update/LoggedIn.elm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/client/elm/Update') diff --git a/src/client/elm/Update/LoggedIn.elm b/src/client/elm/Update/LoggedIn.elm index 5292c25..2dc65c3 100644 --- a/src/client/elm/Update/LoggedIn.elm +++ b/src/client/elm/Update/LoggedIn.elm @@ -19,11 +19,11 @@ import Update.LoggedIn.Account as UA type LoggedAction = UpdateAdd AddPaymentAction | UpdatePayments Payments - | AddPayment UserId String Int Payments + | AddPayment UserId String Int | AddMonthlyPayment PaymentId String Int | ToggleEdit PaymentId - | DeletePayment Payment Payments - | UpdatePage Int Payments + | DeletePayment Payment + | UpdatePage Int | UpdateMonthly UM.MonthlyAction | UpdateAccount UA.AccountAction @@ -34,10 +34,9 @@ updateLoggedIn model action loggedInView = { loggedInView | add = updateAddPayment addPaymentAction loggedInView.add } UpdatePayments payments -> { loggedInView | payments = payments } - AddPayment userId name cost payments -> + AddPayment userId name cost -> { loggedInView - | payments = payments - , currentPage = 1 + | currentPage = 1 , add = initAddPayment Punctual , account = UA.updateAccount (UA.UpdatePayer userId model.currentTime cost) loggedInView.account , paymentsCount = loggedInView.paymentsCount + 1 @@ -51,16 +50,14 @@ updateLoggedIn model action loggedInView = } ToggleEdit id -> { loggedInView | paymentEdition = if loggedInView.paymentEdition == Just id then Nothing else Just id } - DeletePayment payment payments -> + DeletePayment payment -> { loggedInView - | payments = payments - , account = UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account + | account = UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account , paymentsCount = loggedInView.paymentsCount - 1 } - UpdatePage page payments -> + UpdatePage page -> { loggedInView | currentPage = page - , payments = payments } UpdateMonthly monthlyAction -> { loggedInView | monthly = UM.updateMonthly monthlyAction loggedInView.monthly } -- cgit v1.2.3