AKPreference.checks module

Checks whether participants required for an AK are available long enough at the same time as the AK can take place

Used both when participants enter their preferences (see AKPreference.forms.PreferenceFormSet) and in the automatic scheduling workflow (see AKSolverInterface.checks).

AKPreference.checks.valid_availabilities(availabilities) → list[Availability][source]

Filter out invalid availabilities (end not after start, could be created by older versions of the form)

AKPreference.checks.longest_availability(availabilities) → timedelta[source]

Get the length of the longest of the given availabilities (0 if there are none)

class AKPreference.checks.AvailabilityOverlap(longest_slot: timedelta, overlap: list[Availability] = <factory>)[source]

Bases: object

Result of the overlap check of an AK and a participant

longest_slot: timedelta

Duration of the longest slot of the AK

overlap: list[Availability]

Time windows in which both the AK can take place and the participant is available

property longest_overlap: timedelta

Length of the longest window in which both the AK can take place and the participant is available

__init__(longest_slot: timedelta, overlap: list[Availability] = <factory>) → None
property sufficient: bool

Whether the longest slot of the AK fits into the overlap (loose check)

AKPreference.checks.availability_overlap(event: Event, ak: AK, participant_availabilities) → AvailabilityOverlap | None[source]

Compute the overlap of the availabilities of an AK and a participant (loose check: the overlap has to contain a window at least as long as the longest slot of the AK)

Participants without availabilities are treated as available during the whole event, AKs without (valid) availabilities cannot take place at all (same semantics as for the solver export).

Parameters:
  • event – event the AK belongs to

  • ak – AK to check (should have prefetched slots and availabilities if called for many AKs)

  • participant_availabilities – availabilities of the participant

Returns:

overlap information or None if the AK has no slots (and hence does not need to be checked)

Return type:

AvailabilityOverlap | None