diff options
| author | Joris | 2016-11-13 00:49:32 +0100 | 
|---|---|---|
| committer | Joris | 2016-11-13 00:49:32 +0100 | 
| commit | 86a96decdb8892b10c5314eb916ef15a64204450 (patch) | |
| tree | 6f41742d0466f77948680964188144fbff036902 /src/server/Model/Job.hs | |
| parent | bf6a0a0b32a7efb88f75c2e89b84d6907aeb10bc (diff) | |
Send weekly activity at start of week about previous week
Diffstat (limited to 'src/server/Model/Job.hs')
| -rw-r--r-- | src/server/Model/Job.hs | 33 | 
1 files changed, 0 insertions, 33 deletions
diff --git a/src/server/Model/Job.hs b/src/server/Model/Job.hs deleted file mode 100644 index 5b0d89d..0000000 --- a/src/server/Model/Job.hs +++ /dev/null @@ -1,33 +0,0 @@ -module Model.Job -  ( getLastExecution -  , actualizeLastExecution -  , actualizeLastCheck -  ) where - -import Control.Monad.IO.Class (liftIO) - -import Data.Time.Clock (UTCTime, getCurrentTime) -import Data.Maybe (isJust) - -import Database.Persist - -import Model.Database -import Model.JobKind - -getLastExecution :: JobKind -> Persist (Maybe UTCTime) -getLastExecution kind = do -  mbJob <- fmap entityVal <$> selectFirst [JobKind ==. kind] [] -  return (mbJob >>= jobLastExecution) - -actualizeLastExecution :: JobKind -> Persist () -actualizeLastExecution kind = do -  now <- liftIO getCurrentTime -  jobKindDefined <- isJust <$> selectFirst [JobKind ==. kind] [] -  if jobKindDefined -    then updateWhere [JobKind ==. kind] [JobLastExecution =. Just now] -    else insert (Job kind (Just now) (Just now)) >> return () - -actualizeLastCheck :: JobKind -> Persist () -actualizeLastCheck kind = do -  now <- liftIO getCurrentTime -  updateWhere [JobKind ==. kind] [JobLastCheck =. Just now]  | 
