Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Single endpoint for creating creating an order #6635

Merged
merged 16 commits into from
Jan 5, 2020
5 changes: 4 additions & 1 deletion app/api/custom/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@ def create_order():
deleted_at=None).all()
ticket_ids_found = {ticket_information.id for ticket_information in ticket_list}
tickets_not_found = ticket_ids - ticket_ids_found
if tickets_not_found:
if len(tickets_not_found) == 1:
return make_response(jsonify(status='Order Unsuccessful', error='Ticket with id {} was not found in Event {}.'
.format(tickets_not_found, data['event_id'])), 404)
elif len(tickets_not_found) > 1:
return make_response(jsonify(status='Order Unsuccessful', error='Tickets with id {} were not found in Event {}.'
prateekj117 marked this conversation as resolved.
Show resolved Hide resolved
.format(tickets_not_found, data['event_id'])), 404)
for ticket_info in ticket_list:
if (ticket_info.quantity - get_count(db.session.query(TicketHolder.id).filter_by(
ticket_id=int(ticket_info.id), deleted_at=None))) < quantity[ticket_info.id]:
Expand Down