aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-19 20:18:35 +0100
committerJoris Guyonvarch2015-03-19 20:18:39 +0100
commit27917f041ddb438c4fa8576487816220c3824eae (patch)
tree628bcc0d6bf80a3375382f214d28cfbf49fdf2b0 /src
parentaf9465f928f28344aa59a407adb21e5ac047a0f9 (diff)
Fixing updates giving wrong states
Diffstat (limited to 'src')
-rw-r--r--src/Update/Update.elm10
-rw-r--r--src/Update/UpdateTimer.elm2
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm
index 3bdcc2b..c6c5f32 100644
--- a/src/Update/Update.elm
+++ b/src/Update/Update.elm
@@ -11,6 +11,7 @@ import Time (Time)
import Maybe
import Keyboard (KeyCode)
import Char
+import Debug
import Model.Model (..)
import Model.Timer (..)
@@ -38,6 +39,12 @@ type Action =
updates : Signal.Channel Action
updates = Signal.channel NoOp
+logUpdate : Action -> Model -> Model
+logUpdate action model =
+ case action of
+ DeltaTime _ -> update action model
+ _ -> update (Debug.log "action" action) model
+
update : Action -> Model -> Model
update action model =
case action of
@@ -57,9 +64,8 @@ update action model =
, timers <- substractTimersTime delta model.timers
}
UpdateTimer id action ->
-
let maybeTimerEdition = filterMaybe (\timerEdition -> timerEdition.id == id) model.timerEdition
- in case model.timerEdition of
+ in case maybeTimerEdition of
Just timerEdition ->
{ model
| timers <-
diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm
index c147d23..7033f81 100644
--- a/src/Update/UpdateTimer.elm
+++ b/src/Update/UpdateTimer.elm
@@ -41,6 +41,6 @@ updateTimer action timer =
SetTime time ->
let augmentedTime = time + 999
in { timer
- | initialTime <- augmentedTime
+ | initialTime <- time
, currentTime <- augmentedTime
}