aboutsummaryrefslogtreecommitdiff
path: root/src/Update/UpdateTimer.elm
diff options
context:
space:
mode:
authorJoris2016-09-04 21:21:11 +0200
committerJoris2016-09-04 21:21:31 +0200
commit973a039b54327df74396605410ea9abe19c8a4e7 (patch)
treec702564d17e0a490d56845027238eb4f231be785 /src/Update/UpdateTimer.elm
parent62fee9133f36f655c1ed83e0c2e85394f9948bf5 (diff)
Upgrade to elm 0.17.1
Diffstat (limited to 'src/Update/UpdateTimer.elm')
-rw-r--r--src/Update/UpdateTimer.elm57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm
deleted file mode 100644
index 08b9969..0000000
--- a/src/Update/UpdateTimer.elm
+++ /dev/null
@@ -1,57 +0,0 @@
-module Update.UpdateTimer
- ( TimerAction(..)
- , updateTimer
- ) where
-
-import Time exposing (Time)
-
-import Model.Timer exposing (..)
-import Model.TimerState exposing (..)
-import Model.Id exposing (..)
-
-type TimerAction =
- Rename String
- | Pause
- | ToggleRunning
- | Stop
- | SetTime Time
- | SubstractTime Time
-
-updateTimer : TimerAction -> Timer -> Timer
-updateTimer action timer =
- case action of
- Rename name ->
- { timer | name <- Just name }
- Pause ->
- { timer | state <- Idle }
- ToggleRunning ->
- { timer
- | state <-
- if timer.currentTime > 0 && timer.state == Idle
- then Running
- else Idle
- }
- Stop ->
- { timer
- | currentTime <- timer.initialTime
- , state <- Idle
- }
- SetTime time ->
- { timer
- | initialTime <- time
- , currentTime <- time
- }
- SubstractTime time ->
- if timer.state == Running
- then
- let newTime = timer.currentTime - time
- in if newTime <= 0.0
- then
- { timer
- | currentTime <- 0.0
- , state <- Ringing
- }
- else
- { timer | currentTime <- newTime }
- else
- timer