feriennet.views.booking

Attributes

DELETABLE_STATES

Classes

RelatedAttendeeRow

Functions

all_bookings(→ list[onegov.activity.Booking])

Loads all bookings together with the linked occasions, attendees and

group_bookings(→ dict[onegov.activity.Attendee, ...)

Takes a (small) list of bookings and groups them by attendee and state

total_by_bookings(→ decimal.Decimal)

related_attendees(→ dict[uuid.UUID, ...)

attendees_by_username(→ list[onegov.activity.Attendee])

Loads the given attendees linked to the given username, sorted by

get_booking_title(→ str)

actions_by_booking(→ list[onegov.core.elements.Link])

show_error_on_attendee(→ None)

view_my_bookings(→ onegov.core.types.RenderData)

delete_booking(→ None)

cancel_booking(→ None)

toggle_star(→ str)

toggle_nobble(→ str)

render_css(→ morepath.Response)

view_mask(→ str)

create_invite(→ webob.Response)

Creates a group_code on the booking, if one doesn't exist already

view_group_invite(→ onegov.core.types.RenderData)

join_group(→ None)

leave_group(→ None)

Module Contents

class feriennet.views.booking.RelatedAttendeeRow[source]

Bases: NamedTuple

occasion_id: uuid.UUID[source]
attendee_count: int[source]
parent: str[source]
parent_username: str[source]
children: int[source]
phone: str | None[source]
place: str | None[source]
email: str[source]
booking_state: onegov.activity.models.booking.BookingState[source]
feriennet.views.booking.DELETABLE_STATES = ('open', 'cancelled', 'denied', 'blocked')[source]
feriennet.views.booking.all_bookings(collection: onegov.activity.BookingCollection) list[onegov.activity.Booking][source]

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.

feriennet.views.booking.group_bookings(period: Period | PeriodMeta, bookings: Iterable[Booking]) dict[onegov.activity.Attendee, dict[onegov.activity.models.booking.BookingState, sortedcontainers.SortedList[onegov.activity.Booking]]][source]

Takes a (small) list of bookings and groups them by attendee and state and sorting them by date.

feriennet.views.booking.total_by_bookings(period: Period | PeriodMeta | None, bookings: Collection[Booking]) decimal.Decimal[source]
feriennet.views.booking.related_attendees(session: sqlalchemy.orm.Session, occasion_ids: Collection[UUID]) dict[uuid.UUID, list[RelatedAttendeeRow]][source]
feriennet.views.booking.attendees_by_username(request: onegov.feriennet.request.FeriennetRequest, username: str) list[onegov.activity.Attendee][source]

Loads the given attendees linked to the given username, sorted by their name.

feriennet.views.booking.get_booking_title(layout: onegov.feriennet.layout.DefaultLayout, booking: onegov.activity.Booking) str[source]
feriennet.views.booking.actions_by_booking(layout: onegov.feriennet.layout.DefaultLayout, period: Period | PeriodMeta | None, booking: onegov.activity.Booking) list[onegov.core.elements.Link][source]
feriennet.views.booking.show_error_on_attendee(request: onegov.feriennet.request.FeriennetRequest, attendee: onegov.activity.Attendee, message: str) None[source]
feriennet.views.booking.view_my_bookings(self: onegov.activity.BookingCollection, request: onegov.feriennet.request.FeriennetRequest) onegov.core.types.RenderData[source]
feriennet.views.booking.delete_booking(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) None[source]
feriennet.views.booking.cancel_booking(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) None[source]
feriennet.views.booking.toggle_star(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) str[source]
feriennet.views.booking.toggle_nobble(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) str[source]
feriennet.views.booking.render_css(content: str, request: onegov.feriennet.request.FeriennetRequest) morepath.Response[source]
feriennet.views.booking.view_mask(self: onegov.activity.BookingCollection, request: onegov.feriennet.request.FeriennetRequest) str[source]
feriennet.views.booking.create_invite(self: onegov.activity.Booking, request: onegov.feriennet.request.FeriennetRequest) webob.Response[source]

Creates a group_code on the booking, if one doesn’t exist already and redirects to the GroupInvite view.

feriennet.views.booking.view_group_invite(self: onegov.feriennet.models.GroupInvite, request: onegov.feriennet.request.FeriennetRequest) onegov.core.types.RenderData[source]
feriennet.views.booking.join_group(self: onegov.feriennet.models.GroupInvite, request: onegov.feriennet.request.FeriennetRequest) None[source]
feriennet.views.booking.leave_group(self: onegov.feriennet.models.GroupInvite, request: onegov.feriennet.request.FeriennetRequest) None[source]