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

[ASHES] promotions discounts data model issues #2266

Open
bagratinho opened this issue Jun 21, 2017 · 1 comment
Open

[ASHES] promotions discounts data model issues #2266

bagratinho opened this issue Jun 21, 2017 · 1 comment

Comments

@bagratinho
Copy link
Contributor

  1. Go to stage
  2. Go to promotions and hit "create new" button
  3. Write some name, and change the offer type to "discounted shipping"
  4. Write some discount value and hit save

see error below
image

the reason is that phoenix expects

discountedShipping: {
  discount: someNumberHere
}

but receives

discountedShipping: {
  setPrice: someNumberHere
}

This happens only when specifying the offer type to discounted shipping right first, if you edit other offer type, then change the type to discounted shipping, it doesnt throws any errors, cause frontend sends data structure like this

discountedShipping: {
  setPrice: number-user-have-entered-for-discounted-shipping,
  discount: number-user-have-entered-for-other-offer-type-previousely,
}

So phoenix accepts the data, stores bot set price and discount (dunno why) and frontend visualises setPrice, but discount is what really matters.
This issue left unnoticed cause phoenix stores and then returns any additional keys in offer object it receives. cc @jmataya @Anna-ZZZ @mempko

This particular bug is already fixed in scope of this PR - #2207 (see last commit, data structure generated by FE was originally wrong) but still I think its bad that we store any additional data passed as offers object - if not that we could have noticed this bug much earlier.

Second issue is with setPrice offer.

I see that frontend sends this as offer object

setPrice: {
  setPrice: someValue,
}

and if you set offer type as setPrice, specify some value, and hit save, you'll see that it want save with error

failed to compile offer setPrice, couldn't extract attributes: No usable value for numUnits Did not find value which can be converted into int

which means that phoenix expects numUnits key in offer object, which is not set anywhere in frontend, so its not sent.

Not sure how exactly this shall be fixed.
https://docs.google.com/document/d/18GMxZ1_VxbeXF6EOr0xEdz0_Ye6fXP5qPyjhRnqP4cI/edit#heading=h.i3wt1qemqb5d
Its not clear for me when I read this doc.
https://docs.google.com/document/d/18GMxZ1_VxbeXF6EOr0xEdz0_Ye6fXP5qPyjhRnqP4cI/edit#heading=h.i3wt1qemqb5d

@michalrus
Copy link
Contributor

This should have been written with LARGE letters:

This issue left unnoticed cause phoenix stores and then returns any additional keys in offer object it receives. cc @jmataya @Anna-ZZZ @mempko

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

No branches or pull requests

2 participants