fix(avs): eliminate call to undefined in Esqueleto.Internals
This commit is contained in:
parent
256740e15e
commit
240c6f81f8
@ -12,9 +12,9 @@ module Jobs.Handler.SynchroniseAvs
|
|||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|
||||||
import qualified Database.Esqueleto.Legacy as E hiding (upsert)
|
-- import qualified Database.Esqueleto.Legacy as E hiding (upsert)
|
||||||
import qualified Database.Esqueleto.PostgreSQL as E
|
-- import qualified Database.Esqueleto.PostgreSQL as E
|
||||||
import qualified Database.Esqueleto.Utils as E
|
-- import qualified Database.Esqueleto.Utils as E
|
||||||
|
|
||||||
import qualified Data.Conduit.List as C
|
import qualified Data.Conduit.List as C
|
||||||
import Jobs.Queue
|
import Jobs.Queue
|
||||||
@ -63,12 +63,17 @@ dispatchJobSynchroniseAvsUser uid pause = JobHandlerException $ runDB $ workJobS
|
|||||||
workJobSychronizeAvs :: UserId -> Maybe Day -> DB ()
|
workJobSychronizeAvs :: UserId -> Maybe Day -> DB ()
|
||||||
workJobSychronizeAvs uid pause = do
|
workJobSychronizeAvs uid pause = do
|
||||||
now <- liftIO getCurrentTime
|
now <- liftIO getCurrentTime
|
||||||
void $ E.upsert
|
-- void $ E.upsert
|
||||||
AvsSync { avsSyncUser = uid
|
-- AvsSync { avsSyncUser = uid
|
||||||
, avsSyncCreationTime = now
|
-- , avsSyncCreationTime = now
|
||||||
, avsSyncPause = pause
|
-- , avsSyncPause = pause
|
||||||
}
|
-- }
|
||||||
[ \oldSync -> (AvsSyncPause E.=. E.greatest (E.val pause) (oldSync E.^. AvsSyncPause)) oldSync ]
|
-- [ \oldSync -> (AvsSyncPause E.=. E.greatest (E.val pause) (oldSync E.^. AvsSyncPause)) oldSync ] -- causes Esqueleto to call undefined at Database.Esqueleto.Internal.Internal.renderUpdates:1308
|
||||||
|
maybeM
|
||||||
|
(insert_ AvsSync{avsSyncUser=uid, avsSyncCreationTime=now, avsSyncPause=pause})
|
||||||
|
(\Entity{entityKey=asid, entityVal=AvsSync{avsSyncPause=oldPause}} ->
|
||||||
|
update asid [AvsSyncPause =. max pause oldPause, AvsSyncCreationTime =. now])
|
||||||
|
(getBy $ UniqueAvsSyncUser uid)
|
||||||
queueJob' JobSynchroniseAvsQueue
|
queueJob' JobSynchroniseAvsQueue
|
||||||
|
|
||||||
dispatchJobSynchroniseAvsQueue :: JobHandler UniWorX
|
dispatchJobSynchroniseAvsQueue :: JobHandler UniWorX
|
||||||
|
|||||||
Reference in New Issue
Block a user