Skip to content

Conversation

@abhinavk96
Copy link
Contributor

Fixes #6343

There is a case where the client does supply the value for maximum discount codes, by specifying that it is null, this PR handles that case to prevent validation code from breaking.

@codecov
Copy link

codecov bot commented Aug 10, 2019

Codecov Report

Merging #6344 into development will not change coverage.
The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff              @@
##           development    #6344   +/-   ##
============================================
  Coverage        65.26%   65.26%           
============================================
  Files              287      287           
  Lines            14754    14754           
============================================
  Hits              9629     9629           
  Misses            5125     5125
Impacted Files Coverage Δ
app/api/schema/discount_codes.py 59.25% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1148bd...439d3cf. Read the comment docs.

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:
Copy link
Member

@iamareebjamal iamareebjamal Aug 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if 'tickets_number' in data and 'max_quantity' in data and data['max_quantity'] is not None:
if data.get('tickets_number') and data.get('max_quantity'):

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if 'tickets_number' in data and 'max_quantity' in data and data['max_quantity'] is not None:
if data.get('tickets_number') and data.get('max_quantity'):

@iamareebjamal iamareebjamal merged commit 7fc76cb into fossasia:development Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discount codes patch: 500 internal server error

2 participants