activity.models.booking
Attributes
Classes
Bookings are created by users for occasions. |
Module Contents
- activity.models.booking.BookingState: TypeAlias = Literal['open', 'blocked', 'accepted', 'denied', 'cancelled'][source]
- class activity.models.booking.Booking[source]
Bases:
onegov.core.orm.Base
,onegov.core.orm.mixins.TimestampMixin
Bookings are created by users for occasions.
Initially, bookings are open. In this state they represent a “wish” rather than booking.
Because bookings are wishes initially, they get a priority as well as a group code which links multiple bookings by multiple users together.
They system will try to figure out the best booking using the priority as well as the group code.
- group_code_count(states: BookingStates | Literal['*'] = ('open', 'accepted')) int [source]
Returns the number of bookings with the same group code.
- period_bound_booking_state(period: onegov.activity.models.Period) BookingState [source]
During pre-booking we don’t show the actual state of the booking, unless the occasion was cancelled, otherwise the user might see accepted bookings at a point where those states are not confirmed yet.
This methods interprets the period/state accordingly.
- set_priority_bit(index: int, bit: Literal[0, 1]) None [source]
Changes the priority, setting the the nth bit from the right to the value of
bit
(index/n begins at 0).The first bit (index=0) is reserved for starring/unstarring. The second bit (index=1) is reserved for nobble/unnobble.
As a result, starring is less influental than locking.
To give some context: Starring is used by the attendees to select which bookings they favor. Nobbling is used by administrators to force certain bookings to be preferred.