aboutsummaryrefslogtreecommitdiff
path: root/src/Update/Update.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Update/Update.elm')
-rw-r--r--src/Update/Update.elm15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm
index 5a4b12a..8fd5cb3 100644
--- a/src/Update/Update.elm
+++ b/src/Update/Update.elm
@@ -67,14 +67,13 @@ update action model =
}
UpdateTimer id action ->
let maybeEdition = filterMaybe (\edition -> edition.id == id) model.edition
- in case maybeEdition of
- Just edition ->
- { model
- | timers <- Dict.update id (Maybe.map (updateTimer action)) model.timers
- , edition <- Nothing
- }
- Nothing ->
- { model | timers <- Dict.update id (Maybe.map (updateTimer action)) model.timers }
+ newModel =
+ case maybeEdition of
+ Just edition ->
+ if edition.kind == Time then validEdition model else model
+ Nothing ->
+ model
+ in { newModel | timers <- Dict.update id (Maybe.map (updateTimer action)) newModel.timers }
RemoveTimer id ->
if numberOfTimers model > 1
then