diff options
author | Joris | 2017-03-26 22:56:41 +0200 |
---|---|---|
committer | Joris | 2017-03-26 22:56:41 +0200 |
commit | 8062f1c9c34e9b25d76b22bd6ba2a1a99666279b (patch) | |
tree | 2179d31ece8d92864196b38b42ed3a4d01b2f186 /src/client/Model | |
parent | 778040bf9f3f60ec50b1b437f93ab123854917f2 (diff) |
Fix update payment category constraint error
Diffstat (limited to 'src/client/Model')
-rw-r--r-- | src/client/Model/PaymentCategory.elm | 12 |
1 files changed, 4 insertions, 8 deletions
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 |