aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Model/Timer.elm17
-rw-r--r--src/Update/UpdateTimer.elm5
2 files changed, 14 insertions, 8 deletions
diff --git a/src/Model/Timer.elm b/src/Model/Timer.elm
index 7d345b2..bfb734d 100644
--- a/src/Model/Timer.elm
+++ b/src/Model/Timer.elm
@@ -2,6 +2,7 @@ module Model.Timer
( Timer
, initialTimer
, substractTimerTime
+ , initTime
) where
import List
@@ -17,12 +18,13 @@ type alias Timer =
initialTimer : Time -> String -> Timer
initialTimer creationTime name =
- { creationTime = creationTime
- , name = name
- , initialTime = 5 * 60 * 1000
- , currentTime = 5 * 60 * 1000
- , isRunning = True
- }
+ let initialTime = 5 * 60 * 1000
+ in { creationTime = creationTime
+ , name = name
+ , initialTime = initialTime
+ , currentTime = initTime initialTime
+ , isRunning = True
+ }
substractTimerTime : Time -> Timer -> Timer
substractTimerTime time timer =
@@ -40,3 +42,6 @@ substractTimerTime time timer =
}
else
timer
+
+initTime : Time -> Time
+initTime t = t + 999
diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm
index 771ef1c..b3be088 100644
--- a/src/Update/UpdateTimer.elm
+++ b/src/Update/UpdateTimer.elm
@@ -18,10 +18,11 @@ updateTimer action timer =
{ timer | isRunning <- not timer.isRunning }
Restart ->
{ timer
- | currentTime <- timer.initialTime
+ | isRunning <- True
+ , currentTime <- initTime timer.initialTime
}
Stop ->
{ timer
| isRunning <- False
- , currentTime <- timer.initialTime
+ , currentTime <- initTime timer.initialTime
}