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

Uniqueness of coupon code #290

Open
iambibhas opened this issue May 24, 2019 · 1 comment
Open

Uniqueness of coupon code #290

iambibhas opened this issue May 24, 2019 · 1 comment

Comments

@iambibhas
Copy link
Contributor

iambibhas commented May 24, 2019

Right now DiscountCoupon.code are unique only inside the same DiscountPolicy. But here in this bit we assume that coupon codes are unique globally. Which caused couple of failures when we created couple of coupon codes with same name as some old coupon codes.

So there is a confusion about the uniqueness of coupon codes. Are they unique -

  1. within a discount policy
  2. across multiple discount policies but within a single item (as Item links to multiple discount policies)
  3. globally, across all discount policies

We'll need to update our logic accordingly.

/cc @jace @vidya-ram

@jace
Copy link
Member

jace commented Jul 15, 2019

Code needs to be unique to an ItemCollection. This requires two fixes:

  1. Enforce that unique constraint when creating codes (may require a PostgreSQL functional index).
  2. Join to an ItemCollection when looking up a code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants