aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Job.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Model/Job.hs')
-rw-r--r--src/server/Model/Job.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/server/Model/Job.hs b/src/server/Model/Job.hs
index 3d5df96..5b0d89d 100644
--- a/src/server/Model/Job.hs
+++ b/src/server/Model/Job.hs
@@ -1,6 +1,7 @@
module Model.Job
( getLastExecution
, actualizeLastExecution
+ , actualizeLastCheck
) where
import Control.Monad.IO.Class (liftIO)
@@ -24,4 +25,9 @@ actualizeLastExecution kind = do
jobKindDefined <- isJust <$> selectFirst [JobKind ==. kind] []
if jobKindDefined
then updateWhere [JobKind ==. kind] [JobLastExecution =. Just now]
- else insert (Job kind (Just now)) >> return ()
+ else insert (Job kind (Just now) (Just now)) >> return ()
+
+actualizeLastCheck :: JobKind -> Persist ()
+actualizeLastCheck kind = do
+ now <- liftIO getCurrentTime
+ updateWhere [JobKind ==. kind] [JobLastCheck =. Just now]