diff options
author | Joris | 2019-10-06 19:28:54 +0200 |
---|---|---|
committer | Joris | 2019-10-06 19:28:54 +0200 |
commit | f4c5df9e1b1afddeb5a482d4fbe654d0b321159c (patch) | |
tree | 206e02b4b0a6f78d5acf04ce89ff5fa4b07397a2 /server/src/Controller | |
parent | 2d79ab0e0a11f55255fc21a5dfab1598d3beeba3 (diff) |
Make payment edition to work on the frontend
Diffstat (limited to 'server/src/Controller')
-rw-r--r-- | server/src/Controller/Payment.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/src/Controller/Payment.hs b/server/src/Controller/Payment.hs index c700240..38c1c19 100644 --- a/server/src/Controller/Payment.hs +++ b/server/src/Controller/Payment.hs @@ -47,10 +47,10 @@ edit (EditPayment paymentId name cost date category frequency) = result <- liftIO . Query.run $ do editedPayment <- PaymentPersistence.edit (_user_id user) paymentId name cost date frequency case editedPayment of - Just p -> do + Just (old, new) -> do pc <- PaymentCategoryPersistence.save name category - PaymentCategoryPersistence.deleteIfUnused name - return $ Just (p, pc) + PaymentCategoryPersistence.deleteIfUnused (_payment_name old) + return $ Just (new, pc) Nothing -> return Nothing case result of |