From cd3b37adebca99138fad1acca37908183036ace9 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Mon, 16 Mar 2015 00:15:05 +0100 Subject: Initial commit, can create and name 5 minute timers, can toggle running state --- src/Model/Model.elm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Model/Model.elm (limited to 'src/Model/Model.elm') diff --git a/src/Model/Model.elm b/src/Model/Model.elm new file mode 100644 index 0000000..fa97d7b --- /dev/null +++ b/src/Model/Model.elm @@ -0,0 +1,32 @@ +module Model.Model + ( Model + , initialModel + , substractTimersTime + ) where + +import Dict (Dict) +import Dict +import Time (Time) + +import Model.Timer (..) +import Model.Id (..) +import Model.IdGenerator (..) + +type alias Model = + { currentTime : Time + , newTimerName : String + , timers : Dict Id Timer + , timerIdGenerator : IdGenerator + } + +initialModel : Time -> Model +initialModel initialTime = + { currentTime = initialTime + , newTimerName = "" + , timers = Dict.empty + , timerIdGenerator = initialIdGenerator + } + +substractTimersTime : Time -> Dict Id Timer -> Dict Id Timer +substractTimersTime t timers = + Dict.map (\id timer -> substractTimerTime t timer) timers -- cgit v1.2.3