activity.models.occasion_date

Classes

DAYS

Enum where members are also (and must be) ints

OccasionDate

A single start/end date of an occurrence (which may have multiple

Functions

before_flush(→ None)

Module Contents

class activity.models.occasion_date.DAYS[source]

Bases: enum.IntEnum

Enum where members are also (and must be) ints

half = 1[source]
full = 2[source]
many = 4[source]
static has(value: int, mask: int) bool[source]
static compute(localized_start: datetime.datetime, localized_end: datetime.datetime, total_seconds: float) DAYS[source]
class activity.models.occasion_date.OccasionDate[source]

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

A single start/end date of an occurrence (which may have multiple date ranges).

__tablename__ = 'occasion_dates'[source]
__hash__() int[source]

Return hash(self).

id: Column[int][source]
timezone: Column[str][source]
start: Column[datetime][source]
end: Column[datetime][source]
occasion_id: Column[uuid.UUID][source]
occasion: relationship[Occasion][source]
__table_args__[source]
property localized_start: datetime.datetime[source]
property localized_end: datetime.datetime[source]
property active_days: Iterator[int][source]
property weekdays: list[int][source]
duration_in_seconds() float[source]
duration() DAYS[source]
overlaps(other: OccasionDate) bool[source]
activity.models.occasion_date.before_flush(session: sqlalchemy.orm.Session, context: sqlalchemy.orm.UOWTransaction, instances: Sequence[Any]) None[source]