activity.models.occasion
Classes
Describes a single occurrence of an Activity. "Occurence" would have |
Module Contents
- class activity.models.occasion.Occasion[source]
Bases:
onegov.core.orm.Base
,onegov.core.orm.mixins.TimestampMixin
Describes a single occurrence of an Activity. “Occurence” would have been a good word for it too, but that’s used by onegov.event.
So occasion it is.
- activity: sqlalchemy.orm.relationship[activity.models.activity.Activity][source]
- accepted: sqlalchemy.orm.relationship[collections.abc.Sequence[activity.models.booking.Booking]][source]
- period: sqlalchemy.orm.relationship[activity.models.period.Period][source]
- bookings: sqlalchemy.orm.relationship[list[activity.models.booking.Booking]][source]
- dates: sqlalchemy.orm.relationship[list[activity.models.occasion_date.OccasionDate]][source]
- needs: sqlalchemy.orm.relationship[list[activity.models.occasion_need.OccasionNeed]][source]
- on_date_change() None [source]
Date changes are not properly propagated to the observer for some reason, so we do this manually with a hook.
It’s a bit of a hack, but multiple dates per occasion had to be added at the last minute..
- property anti_affinity_group: tuple[str, str][source]
Uses the activity_id/period_id as an anti-affinity group to ensure that an attendee is never given two occasions of the same activity in a single period.
If that is wanted, the attendee is meant to do this after the matching has been done, with a direct booking.
- compute_duration(dates: collections.abc.Collection[activity.models.occasion_date.OccasionDate] | None) int [source]
- compute_order(dates: collections.abc.Collection[activity.models.occasion_date.OccasionDate] | None) int [source]
- compute_active_days(dates: collections.abc.Collection[activity.models.occasion_date.OccasionDate] | None) list[int] [source]
- compute_weekdays(dates: collections.abc.Collection[activity.models.occasion_date.OccasionDate] | None) list[int] [source]
- observe_dates(dates: collections.abc.Collection[activity.models.occasion_date.OccasionDate] | None) None [source]
- validate_dates(key: str, date: activity.models.occasion_date.OccasionDate) activity.models.occasion_date.OccasionDate [source]
- observe_needs(needs: collections.abc.Collection[activity.models.occasion_need.OccasionNeed] | None) None [source]
- property deadline: datetime.date[source]
The date until which this occasion may be booked (inclusive).