refactor(health): avoid duplicate interface health check speficiations

This commit is contained in:
Steffen Jost 2024-07-09 10:39:52 +02:00
parent 9d3198f49b
commit 9a0e8988fa
2 changed files with 7 additions and 7 deletions

View File

@ -281,7 +281,7 @@ retrieveDriversRWithoutF now = do
`E.on` (\(qual :& qualUsr) -> qual E.^. QualificationId E.==. qualUsr E.^. QualificationUserQualification))
E.where_ $ (qual E.^. QualificationAvsLicence E.==. E.justVal lic) -- matches licence
E.&&. (qualUsr E.^. QualificationUserUser E.==. usr E.^. UserId) -- matches user
E.&&. (qualUsr & validQualification now) -- currently valid
E.&&. (qualUsr & validQualification now) -- currently valid
E.where_ $ E.exists (hasValidQual AvsLicenceRollfeld)
E.&&. E.notExists (hasValidQual AvsLicenceVorfeld)
return usr

View File

@ -117,12 +117,12 @@ mkInterfaceLogTable flagError interfs@(reqIfs, banIfs) = do
E.&&. ilog E.^. InterfaceLogWrite E.=~. E.joinV (ihealth E.?. InterfaceHealthWrite )
E.&&. E.notExists (do -- a more specific match does not exist
otherh <- E.from $ E.table @InterfaceHealth
E.where_ $ otherh E.^. InterfaceHealthInterface E.=?. ihealth E.?. InterfaceHealthInterface
E.&&. E.just (otherh E.^. InterfaceHealthHours) E.!=. ihealth E.?. InterfaceHealthHours
E.&&. ( (otherh E.^. InterfaceHealthSubtype E.?=. ilog E.^. InterfaceLogSubtype) E.&&. E.isNothing (E.joinV $ ihealth E.?. InterfaceHealthSubtype)
E.||. otherh E.^. InterfaceHealthSubtype E.=?. ihealth E.?. InterfaceHealthSubtype)
E.&&. ( (otherh E.^. InterfaceHealthWrite E.?=. ilog E.^. InterfaceLogWrite ) E.&&. E.isNothing (E.joinV $ ihealth E.?. InterfaceHealthWrite )
E.||. otherh E.^. InterfaceHealthWrite E.=?. ihealth E.?. InterfaceHealthWrite )
E.where_ $ ilog E.^. InterfaceLogInterface E.==. otherh E.^. InterfaceHealthInterface
E.&&. ilog E.^. InterfaceLogSubtype E.=~. otherh E.^. InterfaceHealthSubtype
E.&&. ilog E.^. InterfaceLogWrite E.=~. otherh E.^. InterfaceHealthWrite
E.&&. ihealth E.?. InterfaceHealthHours E.!=. E.just (otherh E.^. InterfaceHealthHours)
E.&&. (E.isNothing (E.joinV $ ihealth E.?. InterfaceHealthSubtype)
E.||. E.isNothing (E.joinV $ ihealth E.?. InterfaceHealthWrite ))
)
)
let matchUIH crits = E.or