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 qualified Database.Esqueleto.Legacy as E hiding (upsert)
|
||||
import qualified Database.Esqueleto.PostgreSQL as E
|
||||
import qualified Database.Esqueleto.Utils as E
|
||||
-- import qualified Database.Esqueleto.Legacy as E hiding (upsert)
|
||||
-- import qualified Database.Esqueleto.PostgreSQL as E
|
||||
-- import qualified Database.Esqueleto.Utils as E
|
||||
|
||||
import qualified Data.Conduit.List as C
|
||||
import Jobs.Queue
|
||||
@ -63,12 +63,17 @@ dispatchJobSynchroniseAvsUser uid pause = JobHandlerException $ runDB $ workJobS
|
||||
workJobSychronizeAvs :: UserId -> Maybe Day -> DB ()
|
||||
workJobSychronizeAvs uid pause = do
|
||||
now <- liftIO getCurrentTime
|
||||
void $ E.upsert
|
||||
AvsSync { avsSyncUser = uid
|
||||
, avsSyncCreationTime = now
|
||||
, avsSyncPause = pause
|
||||
}
|
||||
[ \oldSync -> (AvsSyncPause E.=. E.greatest (E.val pause) (oldSync E.^. AvsSyncPause)) oldSync ]
|
||||
-- void $ E.upsert
|
||||
-- AvsSync { avsSyncUser = uid
|
||||
-- , avsSyncCreationTime = now
|
||||
-- , avsSyncPause = pause
|
||||
-- }
|
||||
-- [ \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
|
||||
|
||||
dispatchJobSynchroniseAvsQueue :: JobHandler UniWorX
|
||||
|
||||
Loading…
Reference in New Issue
Block a user