diff options
author | Joris Guyonvarch | 2015-03-21 17:54:44 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-21 17:54:44 +0100 |
commit | ced86444353617a9eef0f940401348ee41f05aca (patch) | |
tree | aedf98ac44705ab0e7c3b7620a9853966c48372d /src/Update/Update.elm | |
parent | d57ea4eda1339ae55f1f1f6341d1af6b1a690330 (diff) |
Do not validate time edition if the user did not prodive any numbers, and show the current time if there are no numbers
Diffstat (limited to 'src/Update/Update.elm')
-rw-r--r-- | src/Update/Update.elm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm index 76f3f1d..48d3008 100644 --- a/src/Update/Update.elm +++ b/src/Update/Update.elm @@ -12,6 +12,7 @@ import Maybe import Keyboard (KeyCode) import Char import Debug +import List import Model.Model (..) import Model.Timer (..) @@ -89,10 +90,14 @@ update action model = ValidTimerEdition -> case model.timerEdition of Just timerEdition -> - { model - | timers <- updateTimerTime timerEdition model.timers - , timerEdition <- Nothing - } + if List.isEmpty timerEdition.numbers + then + { model | timerEdition <- Nothing } + else + { model + | timers <- updateTimerTime timerEdition model.timers + , timerEdition <- Nothing + } Nothing -> { model | timerEdition <- Nothing } ReadOnly -> |