From be2663265cc7205ff690a2fbf3346913c812085d Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 21 Mar 2015 18:36:39 +0100 Subject: Do not update timer if no number are provided in all cases --- src/Update/Update.elm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Update') 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 -- cgit v1.2.3