fix(letter): expiry and valid dates were wrong
This commit is contained in:
parent
0a93f79f4e
commit
f8c36636ff
@ -301,6 +301,11 @@ addLocalDays n utct = localTimeToUTCTZ appTZ newLocal
|
||||
newDay = addDays n oldDay
|
||||
newLocal = oldLocal { localDay = newDay }
|
||||
|
||||
-- This is just a Remineder
|
||||
-- addMonths :: Integer -> UTCTime -> UTCTime
|
||||
-- addMonths = addGregorianMonthsRollOver
|
||||
|
||||
|
||||
----------------------
|
||||
-- CalendarDiffDays --
|
||||
----------------------
|
||||
|
||||
@ -19,10 +19,14 @@ import qualified Database.Esqueleto.Utils as E
|
||||
|
||||
import Handler.Utils.Widgets (statusHtml)
|
||||
|
||||
-- | Compute new valid date from old one and from validDuration in months
|
||||
-- Mainly to document which add months functions to use
|
||||
computeNewValidDate :: Integral a => a -> Day -> Day
|
||||
computeNewValidDate = addGregorianMonthsRollOver . toInteger
|
||||
|
||||
statusQualificationBlock :: Bool -> Html
|
||||
statusQualificationBlock s = statusHtml (bool Error Success s) $ iconQualificationBlock s
|
||||
|
||||
|
||||
-- needs refactoring, probbably no longer helpful
|
||||
mkQualificationBlocked :: QualificationStandardReason -> UTCTime -> QualificationUserId -> QualificationUserBlock
|
||||
mkQualificationBlocked reason qualificationUserBlockFrom qualificationUserBlockQualificationUser = QualificationUserBlock{..}
|
||||
@ -190,7 +194,7 @@ renewValidQualificationUsers qid reason renewalTime uids =
|
||||
maxValidTo = addGregorianMonthsRollOver (toInteger $ renewalMonths `div` 2) cutoffday
|
||||
quEnts = filter (\q -> maxValidTo >= (q ^. _entityVal . _qualificationUserValidUntil)) quEntsAll
|
||||
forM_ quEnts $ \(Entity quId QualificationUser{..}) -> do
|
||||
let newValidTo = addGregorianMonthsRollOver (toInteger renewalMonths) qualificationUserValidUntil
|
||||
let newValidTo = computeNewValidDate renewalMonths qualificationUserValidUntil
|
||||
update quId [ QualificationUserValidUntil =. newValidTo
|
||||
, QualificationUserLastRefresh =. cutoffday
|
||||
]
|
||||
|
||||
@ -17,6 +17,7 @@ import Data.FileEmbed (embedFile)
|
||||
|
||||
import Utils.Print.Letters
|
||||
import Handler.Utils.Widgets (nameHtml) -- , nameHtml')
|
||||
import Handler.Utils.Qualification (computeNewValidDate)
|
||||
|
||||
-- TODO: refactor me and turn me into a qualification property (elearningOnly)
|
||||
qualificationPractical :: Text -> Bool
|
||||
@ -111,7 +112,7 @@ instance MDLetter LetterRenewQualification where
|
||||
letterMeta l@LetterRenewQualification{..} DateTimeFormatter{ format } lang Entity{entityKey=rcvrId, entityVal=User{userDisplayName}} =
|
||||
let LetterRenewQualificationData{..} = letterRenewalQualificationFData l
|
||||
isSupervised = rcvrId /= qualHolderID
|
||||
newExpire = addDays (fromIntegral $ fromMaybe 0 qualDuration) qualExpiry
|
||||
newExpire = computeNewValidDate (fromMaybe 0 qualDuration) qualExpiry
|
||||
(qArea, qFormal, qLicence) = qualificationText lang qualName qualShort
|
||||
in mkMeta $
|
||||
guardMonoid isSupervised
|
||||
|
||||
@ -59,18 +59,19 @@ $if(is-de)$
|
||||
<!-- deutsche Version des Briefes -->
|
||||
|
||||
$if(reminder)$
|
||||
dies ist die **letzte Erinnerung**:
|
||||
dies ist die **letzte Erinnerung**: Bis $date$ wurde das E-Learning noch nicht abgeschlossen. Um
|
||||
else$
|
||||
um
|
||||
$endif$
|
||||
um
|
||||
$if(supervisor)$
|
||||
die $qformal$ von **{$examinee$}**
|
||||
die $qformal$ von **{$examinee$}**
|
||||
$else$
|
||||
Ihre $qformal$
|
||||
Ihre $qformal$
|
||||
$endif$
|
||||
zu verlängern, benötigen wir bis zum **$date$** den Nachweis,
|
||||
zu verlängern, benötigen wir bis zum **$expiry$** den Nachweis,
|
||||
dass die
|
||||
$if(practical)$
|
||||
theoretische und praktische
|
||||
theoretische und praktische
|
||||
$endif$
|
||||
flughafenspezifische $qarea$ Recurrent Schulung
|
||||
der Fraport AG gemäß Verordnung der Europäische Union Nr. 139/2014 absolviert wurde.
|
||||
@ -88,21 +89,21 @@ Für die Absolvierung der Schulungsmaßnahme werden 1--2 Stunden benötigt.
|
||||
Der Abschluss der Schulung wird automatisch an das System der Fahrerausbildung übermittelt.
|
||||
|
||||
$if(practical)$
|
||||
Nach erfolgreichem Abschluss der Online-Schulung
|
||||
$if(supervisor)$
|
||||
muss \textbf{$examinee$}
|
||||
$else$
|
||||
lassen Sie
|
||||
$endif$
|
||||
sich von Ihrer Firma zum praktischen Teil der Schulung
|
||||
$if(supervisor)$
|
||||
einplanen lassen.
|
||||
$else$
|
||||
einplanen.
|
||||
$endif$
|
||||
Im Rahmen der 3--4-stündigen praktischen Auffrischung erfolgen Funkübungen
|
||||
sowie die Durchführung einer Übungsfahrt mit Prüfungscharakter
|
||||
im Start-/Landebahnsystem.
|
||||
Nach erfolgreichem Abschluss der Online-Schulung
|
||||
$if(supervisor)$
|
||||
muss \textbf{$examinee$}
|
||||
$else$
|
||||
lassen Sie
|
||||
$endif$
|
||||
sich von Ihrer Firma zum praktischen Teil der Schulung
|
||||
$if(supervisor)$
|
||||
einplanen lassen.
|
||||
$else$
|
||||
einplanen.
|
||||
$endif$
|
||||
Im Rahmen der 3--4-stündigen praktischen Auffrischung erfolgen Funkübungen
|
||||
sowie die Durchführung einer Übungsfahrt mit Prüfungscharakter
|
||||
im Start-/Landebahnsystem.
|
||||
$endif$
|
||||
|
||||
|
||||
@ -111,17 +112,19 @@ $else$
|
||||
|
||||
<!-- englische Version des Briefes -->
|
||||
$if(reminder)$
|
||||
this is a last **reminder**:
|
||||
$endif$
|
||||
in order to maintain
|
||||
$if(supervisor)$
|
||||
the $qformal$ of **$examinee$**,
|
||||
this is a last **reminder**: as of $date$, the e-learning has not been completed. In
|
||||
$else$
|
||||
your $qformal$,
|
||||
in
|
||||
$endif$
|
||||
we require by **$date$**, that the
|
||||
order to maintain
|
||||
$if(supervisor)$
|
||||
the $qformal$ of **$examinee$**,
|
||||
$else$
|
||||
your $qformal$,
|
||||
$endif$
|
||||
we require by **$expiry$**, that the
|
||||
$if(practical)$
|
||||
theorectical and paractical
|
||||
theorectical and paractical
|
||||
$endif$
|
||||
airport-specific recurrent training at Fraport AG,
|
||||
according to European Union Regulation No. 139/2014,
|
||||
@ -140,16 +143,15 @@ The completion of the e-learning will require abut 1--2 hours.
|
||||
Results will be automatically transmitted to Fraport Driver Training.
|
||||
|
||||
$if(practical)$
|
||||
After successful completion of the online training,
|
||||
$if(supervisor)$
|
||||
$examinee$ must be scheduled by your company
|
||||
$else$
|
||||
your company must schedule you
|
||||
$endif$
|
||||
for the practical part of the training.
|
||||
The 3--4 hour practical refresher includes radio exercises and
|
||||
an examination-style test drive within the runway system.
|
||||
After successful completion of the online training,
|
||||
$if(supervisor)$
|
||||
$examinee$ must be scheduled by your company
|
||||
$else$
|
||||
your company must schedule you
|
||||
$endif$
|
||||
for the practical part of the training.
|
||||
The 3--4 hour practical refresher includes radio exercises and
|
||||
an examination-style test drive within the runway system.
|
||||
$endif$
|
||||
|
||||
|
||||
$endif$
|
||||
|
||||
Loading…
Reference in New Issue
Block a user