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

#9858 Fix for promotion of 100 percent with coupon #9919

Merged

Conversation

laurent35240
Copy link
Contributor

Q A
Branch? 1.2
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #9858
License MIT

Copy link
Member

@CoderMaggie CoderMaggie left a comment

Choose a reason for hiding this comment

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

Looks good! 💪
Glad you've written a good scenario. I'm only wondering if maybe we should have a scenario for an order with some shipping cost, to see what happens :)

@CoderMaggie CoderMaggie added the Potential Bug Potential bugs or bugfixes, that needs to be reproduced. label Nov 13, 2018
@Zales0123
Copy link
Member

It's quite strange that this scenario passes... because it does not seem to work in dev environement 😕

zrzut ekranu 2018-11-13 o 09 43 52

zrzut ekranu 2018-11-13 o 09 44 09

zrzut ekranu 2018-11-13 o 09 43 28

zrzut ekranu 2018-11-13 o 09 44 23

It needs some more investigation, there is totally something wrong happening here 😄 I've also confirmed (by going to website manually) that on test env it works 💥

@laurent35240
Copy link
Contributor Author

@Zales0123 In fact the origin of the problem is the PercentType field in Symfony that will save a float for any value different than 100 and an int for 100.

If I save value 99% I got this in configuration field of table sylius_promotion_action
a:1:{s:10:"percentage";d:0.99;}
And with value 100%, I got this
a:1:{s:10:"percentage";i:1;}

I think the BDD test does not see it because it bypass the Symfony form by creating directly promotion action with a percentage set to 1 as a float.

If needed we can chat about a different/better way to fix this issue on slack

@laurent35240
Copy link
Contributor Author

I found a different way to fix this issue cf laurent35240@5ba1a2d

@Zales0123
Copy link
Member

I've just checked that and it seems to work 💪 Could you please push the changes here so we could iterate over it and, hopefully, merge it? :)

It fixes the way data is saved in database after setting promotion action
@laurent35240
Copy link
Contributor Author

Done

@Zales0123
Copy link
Member

@laurent35240 the build failed, could you, please, take a look at it?

@laurent35240
Copy link
Contributor Author

Sure, I will try to take a look at it this evening

@laurent35240
Copy link
Contributor Author

@Zales0123 Build fixed ;-)

@laurent35240 laurent35240 force-pushed the 9858_promotion_coupon_hundred_percent branch from 88943fc to 4ef4380 Compare November 16, 2018 15:41
@laurent35240
Copy link
Contributor Author

HI

@Zales0123 Do you want other corrections on this PR?

@Zales0123 Zales0123 merged commit f1f4cb6 into Sylius:1.2 Nov 30, 2018
@Zales0123
Copy link
Member

Thanks, Laurent! 🥇

pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…pon (laurent35240)

This PR was merged into the 1.2 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.2
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes Sylius#9858 
| License         | MIT



Commits
-------

c46e7b1 Sylius#9858 Fix for promotion of 100 percent with coupon
9280859 Sylius#9858 Another fix for promotion of 100 percent with coupon
4ef4380 PHPDoc added about transformation
c2af9ea Sylius#9858 Directly change view transformer to percent float when building the form for promotion
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…pon (laurent35240)

This PR was merged into the 1.2 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.2
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes Sylius#9858 
| License         | MIT



Commits
-------

c46e7b1 Sylius#9858 Fix for promotion of 100 percent with coupon
9280859 Sylius#9858 Another fix for promotion of 100 percent with coupon
4ef4380 PHPDoc added about transformation
c2af9ea Sylius#9858 Directly change view transformer to percent float when building the form for promotion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants