From 9e6cf2f2f15b3fef1f99a2fcf980eb96945dc936 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 21 Mar 2015 12:33:58 +0100 Subject: Cannot delete a timer if it is the last one --- src/Model/Model.elm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Model/Model.elm') diff --git a/src/Model/Model.elm b/src/Model/Model.elm index b7ac48a..ad1e9da 100644 --- a/src/Model/Model.elm +++ b/src/Model/Model.elm @@ -2,11 +2,13 @@ module Model.Model ( Model , initialModel , substractTimersTime + , numberOfTimers ) where import Dict (Dict) import Dict import Time (Time) +import List import Model.Timer (..) import Model.TimerEdition (..) @@ -33,3 +35,6 @@ initialModel initialTime = substractTimersTime : Time -> Dict Id Timer -> Dict Id Timer substractTimersTime t timers = Dict.map (\id timer -> substractTimerTime t timer) timers + +numberOfTimers : Model -> Int +numberOfTimers = List.length << Dict.toList << .timers -- cgit v1.2.3