diff options
author | Joris Guyonvarch | 2015-03-21 12:33:58 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-21 12:33:58 +0100 |
commit | 9e6cf2f2f15b3fef1f99a2fcf980eb96945dc936 (patch) | |
tree | 3e460acb675bf1511baaaa603d1478f6464bba8a /src/Update/Update.elm | |
parent | 11403e9e7a07494d72df0b225216c15724386aa8 (diff) |
Cannot delete a timer if it is the last one
Diffstat (limited to 'src/Update/Update.elm')
-rw-r--r-- | src/Update/Update.elm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm index c6c5f32..2cb45cb 100644 --- a/src/Update/Update.elm +++ b/src/Update/Update.elm @@ -76,7 +76,11 @@ update action model = Nothing -> { model | timers <- Dict.update id (Maybe.map (updateTimer action)) model.timers } RemoveTimer id -> - { model | timers <- Dict.remove id model.timers } + if numberOfTimers model > 1 + then + { model | timers <- Dict.remove id model.timers } + else + model EditTimer id -> { model | timerEdition <- Just (newTimerEdition id) |