~homeworkprod/byceps

4cc76aba632b9b8ce5fb433139c395c2661bccfc — Jochen Kupperschmidt 2 years ago 4902302
Introduce party service function `get_party`
M byceps/blueprints/admin/core/views.py => byceps/blueprints/admin/core/views.py +1 -1
@@ 30,7 30,7 @@ def inject_template_variables():
        return brand_service.find_brand(party.brand_id)

    def get_party_for_site(site):
        return party_service.find_party(site.party_id)
        return party_service.get_party(site.party_id)

    return {
        'all_brands': brands,

M byceps/blueprints/admin/ticketing/views.py => byceps/blueprints/admin/ticketing/views.py +2 -2
@@ 65,7 65,7 @@ def view_ticket(ticket_id):
    if ticket is None:
        abort(404)

    party = party_service.find_party(ticket.category.party_id)
    party = party_service.get_party(ticket.category.party_id)

    if ticket.order_number:
        order = order_service.find_order_by_order_number(ticket.order_number)


@@ 169,7 169,7 @@ def view_bundle(bundle_id):
    if bundle is None:
        abort(404)

    party = party_service.find_party(bundle.ticket_category.party_id)
    party = party_service.get_party(bundle.ticket_category.party_id)

    tickets = ticket_bundle_service.find_tickets_for_bundle(bundle.id)


M byceps/blueprints/board/views_topic.py => byceps/blueprints/board/views_topic.py +1 -1
@@ 108,7 108,7 @@ def topic_view(topic_id, page):

    service.enrich_creators(postings.items, g.brand_id, g.party_id)

    party = party_service.find_party(g.party_id)
    party = party_service.get_party(g.party_id)

    context = {
        'topic': topic,

M byceps/blueprints/core/views.py => byceps/blueprints/core/views.py +1 -1
@@ 79,7 79,7 @@ def provide_site_mode():

        party_id = site.party_id

        party = party_service.find_party(party_id)
        party = party_service.get_party(party_id)

        g.party_id = party.id
        g.brand_id = party.brand_id

M byceps/blueprints/party/views.py => byceps/blueprints/party/views.py +1 -1
@@ 21,7 21,7 @@ blueprint = create_blueprint('party', __name__)
@templated
def info():
    """Show information about the current party."""
    party = party_service.find_party(g.party_id)
    party = party_service.get_party(g.party_id)

    return {
        'party': party,

M byceps/blueprints/shop/orders/views.py => byceps/blueprints/shop/orders/views.py +1 -1
@@ 29,7 29,7 @@ def index():
    """List orders placed by the current user for the current party."""
    current_user = g.current_user

    party = party_service.find_party(g.party_id)
    party = party_service.get_party(g.party_id)

    shop = shop_service.find_shop_for_party(party.id)
    if shop:

M byceps/blueprints/ticketing/notification_service.py => byceps/blueprints/ticketing/notification_service.py +1 -1
@@ 101,7 101,7 @@ def notify_withdrawn_seat_manager(ticket: Ticket, user: User, manager: User


def _get_party_title():
    party = party_service.find_party(g.party_id)
    party = party_service.get_party(g.party_id)
    return party.title



M byceps/blueprints/ticketing/views.py => byceps/blueprints/ticketing/views.py +2 -2
@@ 35,7 35,7 @@ def index_mine():
    """List tickets related to the current user."""
    current_user = g.current_user

    party = party_service.find_party(g.party_id)
    party = party_service.get_party(g.party_id)

    tickets = ticket_service.find_tickets_related_to_user_for_party(
        current_user.id, party.id)


@@ 65,7 65,7 @@ def view_printable_html(ticket_id):
        abort(404)

    ticket_category = ticket_category_service.find_category(ticket.category_id)
    party = party_service.find_party(ticket_category.party_id)
    party = party_service.get_party(ticket_category.party_id)

    barcode_svg = barcode_service.render_svg(ticket.code)


M byceps/services/orga_team/service.py => byceps/services/orga_team/service.py +1 -1
@@ 136,7 136,7 @@ def get_memberships_for_user(user_id: UserID) -> Sequence[Membership]:

def get_unassigned_orgas_for_party(party_id: PartyID) -> Sequence[DbUser]:
    """Return organizers that are not assigned to a team for the party."""
    party = party_service.find_party(party_id)
    party = party_service.get_party(party_id)

    assigned_orgas = DbUser.query \
        .join(Membership) \

M byceps/services/party/service.py => byceps/services/party/service.py +10 -0
@@ 77,6 77,16 @@ def find_party(party_id: PartyID) -> Optional[Party]:
    return _db_entity_to_party(party)


def get_party(party_id: PartyID) -> Party:
    """Return the party with that id, or `None` if not found."""
    party = find_party(party_id)

    if party is None:
        raise UnknownPartyId(party_id)

    return party


def get_all_parties_with_brands() -> List[DbParty]:
    """Return all parties."""
    return DbParty.query \