chore(lms): allow late qualification renewal by lms success
This commit is contained in:
parent
637af12992
commit
e4908bc4fc
@ -231,19 +231,19 @@ dispatchJobLmsResults qid = JobHandlerAtomic act
|
||||
-- three separate DB operations per result is not so nice. All within one transaction though.
|
||||
let lmsUserStartedDay = localDay $ TZ.utcToLocalTimeTZ appTZ lmsUserStarted
|
||||
saneDate = lmsResultSuccess `inBetween` (lmsUserStartedDay, min qualificationUserValidUntil locDay)
|
||||
&& qualificationUserLastRefresh <= utctDay lmsUserStarted
|
||||
-- && qualificationUserLastRefresh <= utctDay lmsUserStarted NOTE: not always true due to manual intervention; also renewValidQualificationUsers prevents double renewals anyway
|
||||
newStatus = Just $ LmsSuccess lmsResultSuccess
|
||||
-- newValidTo = addGregorianMonthsRollOver (toInteger renewalMonths) qualificationUserValidUntil -- renew from old validUntil onwards
|
||||
note <- if saneDate && replaceLmsStatus lmsUserStatus newStatus
|
||||
then do
|
||||
_ok <- renewValidQualificationUsers qid [qualificationUserUser] -- ignores possible blocks
|
||||
-- when (ok==1) $ update luid -- we end lms regardless of wether a regular renewal was successful, since BPol users may simultaneoysly have on-premise renewal courses and E-Learnings
|
||||
|
||||
-- WORKAROUND LMS-Bug [supposedly fixed now, but isnt]: sometimes we receive success and failure simultaneously; success is correct, hence we must unblock if the reason was e-learning
|
||||
-- _ok <- qualificationUserUnblockByReason qid [qualificationUserUser] (qualificationBlockedReasonText QualificationBlockFailedELearning) -- affects audit log
|
||||
when (Just (qualificationBlockedReasonText QualificationBlockFailedELearning) == qualificationUserBlockedDue ^? _Just . _qualificationBlockedReason) $
|
||||
update quid [ QualificationUserBlockedDue =. Nothing ]
|
||||
|
||||
_ok <- renewValidQualificationUsers qid [qualificationUserUser] -- ignores possible blocks
|
||||
-- when (ok==1) $ update luid -- we end lms regardless of whether or not a regular renewal was successful, since BPol users may simultaneoysly have on-premise renewal courses and E-Learnings
|
||||
|
||||
update luid
|
||||
[ LmsUserStatus =. newStatus
|
||||
, LmsUserReceived =. Just lmsResultTimestamp
|
||||
|
||||
Loading…
Reference in New Issue
Block a user