activity.models.attendee

Classes

Attendee

Attendees are linked to zero to many bookings. Each booking

Module Contents

class activity.models.attendee.Attendee[source]

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

Attendees are linked to zero to many bookings. Each booking has an attendee.

Though an attendee may be the same person as a username in reality, in the model we treat those subjects as separate.

__tablename__ = 'attendees'[source]
fts_type_title[source]
fts_title_property = 'title'[source]
fts_properties[source]
fts_public = False[source]
property fts_suggestion: str[source]
property title: str[source]
__hash__() → int[source]
id: sqlalchemy.orm.Mapped[uuid.UUID][source]
username: sqlalchemy.orm.Mapped[str][source]
name: sqlalchemy.orm.Mapped[str][source]
birth_date: sqlalchemy.orm.Mapped[datetime.date][source]
gender: sqlalchemy.orm.Mapped[str | None][source]
notes: sqlalchemy.orm.Mapped[str | None][source]
swisspass: sqlalchemy.orm.Mapped[str | None][source]
differing_address: sqlalchemy.orm.Mapped[bool][source]
address: sqlalchemy.orm.Mapped[str | None][source]
zip_code: sqlalchemy.orm.Mapped[str | None][source]
place: sqlalchemy.orm.Mapped[str | None][source]
political_municipality: sqlalchemy.orm.Mapped[str | None][source]
limit: sqlalchemy.orm.Mapped[int | None][source]
user: sqlalchemy.orm.Mapped[onegov.user.User][source]
subscription_token: sqlalchemy.orm.Mapped[str][source]
validate_gender(field: str, value: str | None) → str | None[source]
age() → int[source]
classmethod _age_expression() → sqlalchemy.sql.ColumnElement[int][source]
happiness(period_id: uuid.UUID) → float | None[source]

Returns the happiness of the attende in the given period.

The happiness is a value between 0.0 and 1.0, indicating how many of the bookings on the wishlist were fulfilled.

If all bookings were fulfilled, the happiness is 1.0, if no bookings were fulfilled the hapiness is 0.0.

The priority of the bookings is taken into account. The decision on a high-priority booking has a higher impact than the decision on a low-priority booking. To model this we simply multiply the booking priority when summing up the happiness. So if a booking with priority 1 is accepted, it is as if 2 bookings were accepted. If a booking with priority 1 is denied, it is as if 2 bookings were denied.

classmethod _happiness_expression(period_id: uuid.UUID) → sqlalchemy.sql.ColumnElement[float | None][source]
bookings: sqlalchemy.orm.Mapped[list[onegov.activity.models.booking.Booking]][source]
__table_args__[source]