activity.models.period

Module Contents

Classes

Period

Mixin providing created/modified timestamps for all records.

class activity.models.period.Period[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin

Mixin providing created/modified timestamps for all records.

The columns are deferred loaded as this is primarily for logging and future forensics.

property age_barrier: onegov.activity.models.age_barrier.AgeBarrier[source]
property booking_limit: int | None[source]

Returns the max_bookings_per_attendee limit if it applies.

property phase: str | None[source]
property wishlist_phase: bool[source]
property booking_phase: bool[source]
property payment_phase: bool[source]
property execution_phase: bool[source]
property archive_phase: bool[source]
property is_prebooking_in_future: bool[source]
property is_currently_prebooking: bool[source]
property is_prebooking_in_past: bool[source]

Returns true if current date is after start of booking phase or if current date is after prebooking end.

property is_booking_in_future: bool[source]
property is_currently_booking: bool[source]
property is_booking_in_past: bool[source]
property is_execution_in_past: bool[source]
property scoring: onegov.activity.matching.score.Scoring[source]
__tablename__ = 'periods'[source]
timezone: ClassVar[str] = 'Europe/Zurich'[source]
id: Column[uuid.UUID][source]
title: Column[str][source]
active: Column[bool][source]
confirmed: Column[bool][source]
confirmable: Column[bool][source]
finalized: Column[bool][source]
finalizable: Column[bool][source]
archived: Column[bool][source]
prebooking_start: Column[date][source]
prebooking_end: Column[date][source]
booking_start: Column[date][source]
booking_end: Column[date][source]
execution_start: Column[date][source]
execution_end: Column[date][source]
data: Column[dict[str, Any]][source]
max_bookings_per_attendee: Column[int | None][source]
booking_cost: Column[Decimal | None][source]
all_inclusive: Column[bool][source]
pay_organiser_directly: Column[bool][source]
minutes_between: Column[int | None][source]
alignment: Column[str | None][source]
deadline_days: Column[int | None][source]
book_finalized: Column[bool][source]
cancellation_date: Column[date | None][source]
cancellation_days: Column[int | None][source]
age_barrier_type: Column[str][source]
__table_args__ = ()[source]
occasions: relationship[list[Occasion]][source]
bookings: relationship[list[Booking]][source]
validate_age_barrier_type(key: str, age_barrier_type: str) str[source]
activate() None[source]

Activates the current period, causing all occasions and activites to update their status and book-keeping.

It also makes sure no other period is active.

deactivate() None[source]

Deactivates the current period, causing all occasions and activites to update their status and book-keeping.

confirm() None[source]

Confirms the current period.

archive() None[source]

Moves all accepted activities with an occasion in this period into the archived state, unless there’s already another occasion in a period newer than the current period.

as_local_datetime(day: datetime.date | datetime.datetime, end_of_day: bool = False) datetime.datetime[source]

Returns the moment of midnight in terms of the timezone it UTC

confirm_and_start_booking_phase() None[source]

Confirms the period and sets the booking phase to now.

This is mainly an internal convenience function to activate the previous behaviour before a specific booking phase date was introduced.