feriennet.views.booking ======================= .. py:module:: feriennet.views.booking Attributes ---------- .. autoapisummary:: feriennet.views.booking.DELETABLE_STATES Classes ------- .. autoapisummary:: feriennet.views.booking.RelatedAttendeeRow Functions --------- .. autoapisummary:: feriennet.views.booking.all_bookings feriennet.views.booking.group_bookings feriennet.views.booking.total_by_bookings feriennet.views.booking.related_attendees feriennet.views.booking.attendees_by_username feriennet.views.booking.get_booking_title feriennet.views.booking.actions_by_booking feriennet.views.booking.show_error_on_attendee feriennet.views.booking.view_my_bookings feriennet.views.booking.delete_booking feriennet.views.booking.cancel_booking feriennet.views.booking.toggle_star feriennet.views.booking.toggle_nobble feriennet.views.booking.render_css feriennet.views.booking.view_mask feriennet.views.booking.create_invite feriennet.views.booking.view_group_invite feriennet.views.booking.join_group feriennet.views.booking.leave_group Module Contents --------------- .. py:class:: RelatedAttendeeRow Bases: :py:obj:`NamedTuple` .. py:attribute:: occasion_id :type: uuid.UUID .. py:attribute:: attendee_count :type: int .. py:attribute:: parent :type: str .. py:attribute:: parent_username :type: str .. py:attribute:: children :type: int .. py:attribute:: phone :type: str | None .. py:attribute:: place :type: str | None .. py:attribute:: email :type: str .. py:attribute:: booking_state :type: onegov.activity.models.booking.BookingState .. py:data:: DELETABLE_STATES :value: ('open', 'cancelled', 'denied', 'blocked') .. py:function:: all_bookings(collection: onegov.activity.BookingCollection) -> list[onegov.activity.Booking] Loads all bookings together with the linked occasions, attendees and activities. This is somewhat of a heavy query, but it beats having to load all these things separately. .. py:function:: group_bookings(period: onegov.activity.models.Period | onegov.activity.models.PeriodMeta, bookings: collections.abc.Iterable[onegov.activity.Booking]) -> dict[onegov.activity.Attendee, dict[onegov.activity.models.booking.BookingState, sortedcontainers.SortedList[onegov.activity.Booking]]] Takes a (small) list of bookings and groups them by attendee and state and sorting them by date. .. py:function:: total_by_bookings(period: onegov.activity.models.Period | onegov.activity.models.PeriodMeta | None, bookings: collections.abc.Collection[onegov.activity.Booking]) -> decimal.Decimal .. py:function:: related_attendees(session: sqlalchemy.orm.Session, occasion_ids: collections.abc.Collection[uuid.UUID]) -> dict[uuid.UUID, list[RelatedAttendeeRow]] .. py:function:: attendees_by_username(request: onegov.feriennet.request.FeriennetRequest, username: str) -> list[onegov.activity.Attendee] Loads the given attendees linked to the given username, sorted by their name. .. py:function:: get_booking_title(layout: onegov.feriennet.layout.DefaultLayout, booking: onegov.activity.Booking) -> str .. py:function:: actions_by_booking(layout: onegov.feriennet.layout.DefaultLayout, period: onegov.activity.models.Period | onegov.activity.models.PeriodMeta | None, booking: onegov.activity.Booking) -> list[onegov.core.elements.Link] .. py:function:: show_error_on_attendee(request: onegov.feriennet.request.FeriennetRequest, attendee: onegov.activity.Attendee, message: str) -> None .. py:function:: view_my_bookings(self: onegov.activity.BookingCollection, request: onegov.feriennet.request.FeriennetRequest) -> onegov.core.types.RenderData .. py:function:: delete_booking(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) -> None .. py:function:: cancel_booking(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) -> None .. py:function:: toggle_star(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) -> str .. py:function:: toggle_nobble(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) -> str .. py:function:: render_css(content: str, request: onegov.feriennet.request.FeriennetRequest) -> morepath.Response .. py:function:: view_mask(self: onegov.activity.BookingCollection, request: onegov.feriennet.request.FeriennetRequest) -> str .. py:function:: create_invite(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) -> webob.Response Creates a group_code on the booking, if one doesn't exist already and redirects to the GroupInvite view. .. py:function:: view_group_invite(self: onegov.feriennet.models.GroupInvite, request: onegov.feriennet.request.FeriennetRequest) -> onegov.core.types.RenderData .. py:function:: join_group(self: onegov.feriennet.models.GroupInvite, request: onegov.feriennet.request.FeriennetRequest) -> None .. py:function:: leave_group(self: onegov.feriennet.models.GroupInvite, request: onegov.feriennet.request.FeriennetRequest) -> None