From 4e5f27a5b1428b9ad190a87a6bf0d4fe187387c9 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Mon, 16 Mar 2015 20:37:44 +0100 Subject: Adding a remove button to delete a timer --- src/Model/Model.elm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Model') diff --git a/src/Model/Model.elm b/src/Model/Model.elm index fa97d7b..a3b4780 100644 --- a/src/Model/Model.elm +++ b/src/Model/Model.elm @@ -21,11 +21,12 @@ type alias Model = initialModel : Time -> Model initialModel initialTime = - { currentTime = initialTime - , newTimerName = "" - , timers = Dict.empty - , timerIdGenerator = initialIdGenerator - } + let (id, idGenerator) = getId initialIdGenerator + in { currentTime = initialTime + , newTimerName = "" + , timers = Dict.insert id (initialTimer initialTime "Timer") Dict.empty + , timerIdGenerator = idGenerator + } substractTimersTime : Time -> Dict Id Timer -> Dict Id Timer substractTimersTime t timers = -- cgit v1.2.3