activity.models.age_barrier

Classes

AgeBarrier

Holds various age barrier approaches available to the period.

ExactAgeBarrier

Checks the age by exact date.

YearAgeBarrier

Checks the age by using the year of the start_date and the age.

Module Contents

class activity.models.age_barrier.AgeBarrier[source]

Holds various age barrier approaches available to the period.

registry: dict[str, type[AgeBarrier]][source]
classmethod __init_subclass__(name: str, **kwargs: object)[source]
classmethod from_name(name: str, *args: object, **kwargs: object) AgeBarrier[source]
abstract is_too_young(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, min_age: int) bool[source]
abstract is_too_old(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, max_age: int) bool[source]
class activity.models.age_barrier.ExactAgeBarrier[source]

Bases: AgeBarrier

Checks the age by exact date.

The attendee can be 1 year too old (otherwise, the day the attendee is a day older than the max age, he’ll be rejected - in other word the min age is exclusive, the max age is inclusive).

age(birth_date: datetime.date | datetime.datetime, start_date: datetime.date) int[source]

Calculates the age at the given date.

is_too_young(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, min_age: int) bool[source]
is_too_old(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, max_age: int) bool[source]
class activity.models.age_barrier.YearAgeBarrier[source]

Bases: AgeBarrier

Checks the age by using the year of the start_date and the age.

In German, we would say this is by “Jahrgang”. The person must be of that age during the year of the start date.

is_too_young(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, min_age: int) bool[source]
is_too_old(birth_date: datetime.date | datetime.datetime, start_date: datetime.date, max_age: int) bool[source]