aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/LoggedIn/Update.elm4
-rw-r--r--src/client/Model/PaymentCategory.elm12
2 files changed, 6 insertions, 10 deletions
diff --git a/src/client/LoggedIn/Update.elm b/src/client/LoggedIn/Update.elm
index 9e6d6ee..f5ce7ea 100644
--- a/src/client/LoggedIn/Update.elm
+++ b/src/client/LoggedIn/Update.elm
@@ -74,7 +74,7 @@ update model msg loggedIn =
let newPayment = Payment paymentId name cost date loggedIn.me frequency
in ( { loggedIn
| payments = newPayment :: loggedIn.payments
- , paymentCategories = PaymentCategory.set name category loggedIn.paymentCategories
+ , paymentCategories = PaymentCategory.save name category loggedIn.paymentCategories
}
, Cmd.none
)
@@ -88,7 +88,7 @@ update model msg loggedIn =
, paymentCategories =
case mbOldPayment of
Just oldPayment ->
- PaymentCategory.update oldPayment.name name category loggedIn.paymentCategories
+ PaymentCategory.save name category loggedIn.paymentCategories
Nothing ->
loggedData.paymentCategories
}
diff --git a/src/client/Model/PaymentCategory.elm b/src/client/Model/PaymentCategory.elm
index 87678fe..bb6c152 100644
--- a/src/client/Model/PaymentCategory.elm
+++ b/src/client/Model/PaymentCategory.elm
@@ -3,8 +3,7 @@ module Model.PaymentCategory exposing
, paymentCategoriesDecoder
, search
, isCategoryUnused
- , set
- , update
+ , save
)
import Dict exposing (Dict)
@@ -40,9 +39,6 @@ isCategoryUnused category paymentCategories =
|> List.filter ((==) category << .category)
|> List.isEmpty
-set : String -> CategoryId -> PaymentCategories -> PaymentCategories
-set name category paymentCategories = update name name category paymentCategories
-
-update : String -> String -> CategoryId -> PaymentCategories -> PaymentCategories
-update oldName newName category paymentCategories =
- { name = newName, category = category } :: List.filter (\pc -> not <| Search.format pc.name == Search.format oldName) paymentCategories
+save : String -> CategoryId -> PaymentCategories -> PaymentCategories
+save name category paymentCategories =
+ { name = name, category = category } :: List.filter (\pc -> not <| Search.format pc.name == Search.format name) paymentCategories