fix(sql): remove potential bug in relation to missing parenthesis after not_
This commit is contained in:
parent
e2be8bbd5c
commit
42695cf5ef
@ -17,7 +17,7 @@ module Database.Esqueleto.Utils
|
|||||||
, (>~.), (<~.)
|
, (>~.), (<~.)
|
||||||
, or, and
|
, or, and
|
||||||
, any, all
|
, any, all
|
||||||
-- , parens
|
, not__, parens
|
||||||
, subSelectAnd, subSelectOr
|
, subSelectAnd, subSelectOr
|
||||||
, mkExactFilter, mkExactFilterWith, mkExactFilterWithComma
|
, mkExactFilter, mkExactFilterWith, mkExactFilterWithComma
|
||||||
, mkExactFilterLast, mkExactFilterLastWith
|
, mkExactFilterLast, mkExactFilterLastWith
|
||||||
@ -253,6 +253,9 @@ subSelectOr q = parens . E.subSelectUnsafe $ flip (E.unsafeSqlAggregateFunction
|
|||||||
parens :: E.SqlExpr (E.Value a) -> E.SqlExpr (E.Value a)
|
parens :: E.SqlExpr (E.Value a) -> E.SqlExpr (E.Value a)
|
||||||
parens = E.unsafeSqlFunction ""
|
parens = E.unsafeSqlFunction ""
|
||||||
|
|
||||||
|
-- | Workaround for Esqueleto-Bug not placing parenthesis after NOT, see #155
|
||||||
|
not__ :: E.SqlExpr (E.Value Bool) -> E.SqlExpr (E.Value Bool)
|
||||||
|
not__ = E.not_ . parens
|
||||||
|
|
||||||
-- Allow usage of Tuples as DbtRowKey, i.e. SqlIn instances for tuples
|
-- Allow usage of Tuples as DbtRowKey, i.e. SqlIn instances for tuples
|
||||||
$(sqlInTuples [2..16])
|
$(sqlInTuples [2..16])
|
||||||
|
|||||||
@ -189,7 +189,7 @@ guessUser (((Set.toList . toNullable) <$>) . Set.toList . dnfTerms -> criteria)
|
|||||||
|
|
||||||
containsAsSet x y = E.and . map (\y' -> x `E.hasInfix` E.val y') $ asWords y
|
containsAsSet x y = E.and . map (\y' -> x `E.hasInfix` E.val y') $ asWords y
|
||||||
|
|
||||||
toSql user pl = bool id E.not_ (is _PLNegated pl) $ case pl ^. _plVar of
|
toSql user pl = bool id E.not__ (is _PLNegated pl) $ case pl ^. _plVar of
|
||||||
GuessUserMatrikelnummer userMatriculation' -> user E.^. UserMatrikelnummer E.==. E.val (Just userMatriculation')
|
GuessUserMatrikelnummer userMatriculation' -> user E.^. UserMatrikelnummer E.==. E.val (Just userMatriculation')
|
||||||
GuessUserEduPersonPrincipalName userEPPN' -> user E.^. UserLdapPrimaryKey E.==. E.val (Just userEPPN')
|
GuessUserEduPersonPrincipalName userEPPN' -> user E.^. UserLdapPrimaryKey E.==. E.val (Just userEPPN')
|
||||||
GuessUserDisplayName userDisplayName' -> user E.^. UserDisplayName `containsAsSet` userDisplayName'
|
GuessUserDisplayName userDisplayName' -> user E.^. UserDisplayName `containsAsSet` userDisplayName'
|
||||||
|
|||||||
@ -202,7 +202,7 @@ dispatchJobLmsDequeue qid = JobHandlerAtomic act
|
|||||||
-- E.&&. luser E.?. LmsUserQualification E.?=. E.val qid
|
-- E.&&. luser E.?. LmsUserQualification E.?=. E.val qid
|
||||||
-- E.&&. E.isNothing (luser E.^. LmsUserStatus)
|
-- E.&&. E.isNothing (luser E.^. LmsUserStatus)
|
||||||
-- E.&&. E.isNothing (luser E.^. LmsUserEnded)
|
-- E.&&. E.isNothing (luser E.^. LmsUserEnded)
|
||||||
E.&&. E.not_ (validQualification now quser)
|
E.&&. E.not__ (validQualification now quser)
|
||||||
pure (luser E.?. LmsUserId, quser E.^. QualificationUserUser)
|
pure (luser E.?. LmsUserId, quser E.^. QualificationUserUser)
|
||||||
nrBlocked <- qualificationUserBlocking qid (E.unValue . snd <$> expiredUsers) False (Just now) (Right QualificationBlockExpired) True -- essential that blocks occur only once
|
nrBlocked <- qualificationUserBlocking qid (E.unValue . snd <$> expiredUsers) False (Just now) (Right QualificationBlockExpired) True -- essential that blocks occur only once
|
||||||
let expiredLearners = [ luid | (E.Value (Just luid), _) <- expiredUsers ]
|
let expiredLearners = [ luid | (E.Value (Just luid), _) <- expiredUsers ]
|
||||||
@ -223,7 +223,7 @@ dispatchJobLmsDequeue qid = JobHandlerAtomic act
|
|||||||
`E.on` (\(quser :& qblock) -> qblock E.?. QualificationUserBlockQualificationUser E.?=. quser E.^. QualificationUserId
|
`E.on` (\(quser :& qblock) -> qblock E.?. QualificationUserBlockQualificationUser E.?=. quser E.^. QualificationUserId
|
||||||
E.&&. qblock `isLatestBlockBefore` E.val now
|
E.&&. qblock `isLatestBlockBefore` E.val now
|
||||||
)
|
)
|
||||||
E.where_ $ -- E.not_ (validQualification now quser) -- currently invalid
|
E.where_ $ -- E.not__ (validQualification now quser) -- currently invalid
|
||||||
quser E.^. QualificationUserQualification E.==. E.val qid -- correct qualification
|
quser E.^. QualificationUserQualification E.==. E.val qid -- correct qualification
|
||||||
E.&&. quserToNotify now quser qblock -- recently became invalid or blocked
|
E.&&. quserToNotify now quser qblock -- recently became invalid or blocked
|
||||||
pure (quser E.^. QualificationUserUser)
|
pure (quser E.^. QualificationUserUser)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user