Skip to content

Commit

Permalink
fix: check for case where client sends null for max_quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavk96 committed Aug 10, 2019
1 parent c1148bd commit 91d93e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/api/schema/discount_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def validate_quantity(self, data, original_data):

DiscountCodeSchemaEvent.quantity_validation_helper(data)

if 'tickets_number' in data and 'max_quantity' in data:
if 'tickets_number' in data and 'max_quantity' in data and data['max_quantity'] is not None:
if data['tickets_number'] < data['max_quantity']:
raise UnprocessableEntity({'pointer': '/data/attributes/tickets-number'},
"tickets-number should be greater than max-quantity")
Expand Down Expand Up @@ -149,7 +149,7 @@ def validate_quantity(self, data, original_data):

DiscountCodeSchemaTicket.quantity_validation_helper(data)

if 'tickets_number' in data and 'max_quantity' in data:
if 'tickets_number' in data and 'max_quantity' in data and data['max_quantity'] is not None:
if data['tickets_number'] < data['max_quantity']:
raise UnprocessableEntity({'pointer': '/data/attributes/tickets-number'},
"tickets-number should be greater than max-quantity")
Expand Down

0 comments on commit 91d93e1

Please sign in to comment.