~homeworkprod/byceps

84096a6c0505a8f6a5c98ea451b2d9847ff28fdb — Jochen Kupperschmidt 4 years ago 7f024cc
Don't load brand anymore when obtaining the current party
2 files changed, 1 insertions(+), 8 deletions(-)

M byceps/blueprints/party/views.py
M byceps/services/party/service.py
M byceps/blueprints/party/views.py => byceps/blueprints/party/views.py +1 -1
@@ 22,7 22,7 @@ blueprint = create_blueprint('party', __name__)
def before_request():
    party_id = get_current_party_id()

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

    if party is None:
        raise Exception('Unknown party ID "{}".'.format(party_id))

M byceps/services/party/service.py => byceps/services/party/service.py +0 -7
@@ 69,13 69,6 @@ def find_party(party_id: PartyID) -> Optional[Party]:
    return Party.query.get(party_id)


def find_party_with_brand(party_id: PartyID) -> Optional[Party]:
    """Return the party with that id, or `None` if not found."""
    return Party.query \
        .options(db.joinedload('brand')) \
        .get(party_id)


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