aboutsummaryrefslogtreecommitdiff
path: root/src/Update/Update.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-21 18:36:39 +0100
committerJoris Guyonvarch2015-03-21 18:36:39 +0100
commitbe2663265cc7205ff690a2fbf3346913c812085d (patch)
tree5662876b0a33fe42f29ab17bf9d8047195b5fe1e /src/Update/Update.elm
parent3f2fd27323894036e1b06e1f6f34222dc84df6b1 (diff)
Do not update timer if no number are provided in all cases
Diffstat (limited to 'src/Update/Update.elm')
-rw-r--r--src/Update/Update.elm18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm
index 48d3008..f96a128 100644
--- a/src/Update/Update.elm
+++ b/src/Update/Update.elm
@@ -90,14 +90,10 @@ update action model =
ValidTimerEdition ->
case model.timerEdition of
Just timerEdition ->
- if List.isEmpty timerEdition.numbers
- then
- { model | timerEdition <- Nothing }
- else
- { model
- | timers <- updateTimerTime timerEdition model.timers
- , timerEdition <- Nothing
- }
+ { model
+ | timers <- updateTimerTime timerEdition model.timers
+ , timerEdition <- Nothing
+ }
Nothing ->
{ model | timerEdition <- Nothing }
ReadOnly ->
@@ -111,7 +107,11 @@ update action model =
updateTimerTime : TimerEdition -> Dict Id Timer -> Dict Id Timer
updateTimerTime timerEdition =
- Dict.update timerEdition.id (Maybe.map (updateTimer (SetTime (toTime timerEdition.numbers))))
+ if List.isEmpty timerEdition.numbers
+ then
+ identity
+ else
+ Dict.update timerEdition.id (Maybe.map (updateTimer (SetTime (toTime timerEdition.numbers))))
isRemoveKeyCode : KeyCode -> Bool
isRemoveKeyCode = (==) 8