Skip to content

Tierprice can t save float percentage value 18651 #19584

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

Conversation

novikor
Copy link
Contributor

@novikor novikor commented Dec 5, 2018

Description (*)

See #18651

Fixed Issues (if relevant)

  1. Tierprice can't save float percentage value #18651: Tierprice can't save float percentage value

Manual testing scenarios (*)

Steps to reproduce (*)

  1. Add new product
  2. Add new tierprice with "discount" value "12.5"
  3. Save the product

Expected result (*)

  1. Saving the tierprice as you set it "12.5"

Actual result (*)

  1. It's converted to INT then save it

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team magento-engcom-team added Partner: ISM eCompany Pull Request is created by partner ISM eCompany partners-contribution Pull Request is created by Magento Partner Component: Catalog Release Line: 2.3 labels Dec 5, 2018
@magento-engcom-team
Copy link
Contributor

Hi @novikor. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@novikor
Copy link
Contributor Author

novikor commented Dec 5, 2018

@magento-engcom-team give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @novikor. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @novikor, here is your new Magento instance.
Admin access: https://pr-19584.instances.magento-community.engineering/admin
Login: admin Password: 123123q

@novikor novikor force-pushed the Tierprice-can-t-save-float-percentage-value-18651 branch from 4c0bce9 to 48f77bd Compare December 5, 2018 14:44
@orlangur orlangur self-assigned this Dec 5, 2018
*/
private function getPercentage(array $priceRow): ?int
private function getPercentage(array $priceRow): ?float
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned in previous incarnation of this PR - type hinting needs to be removed so that any of int/float is preserved. Type casting within function should be done with + 0 or * 1.

Also, please squash all changes into a single commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@orlangur , okay, but is there a real reason to avoid float type hint?
As I saw, there were errors in tests because of removed isset statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please review.

Copy link
Contributor

Choose a reason for hiding this comment

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

a real reason to avoid float type hint?

Just that there is no reason to convert int.

@novikor novikor force-pushed the Tierprice-can-t-save-float-percentage-value-18651 branch 3 times, most recently from 03028de to 9f71ffd Compare December 5, 2018 15:09
@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Dec 5, 2018
@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-3625 has been created to process this Pull Request

Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

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

QA report

Problem: Incorrect percentage value of discount on product page.
Manual testing scenario:

Add new product
Add new tierprice with "discount" value "12.5"
Save the product
Go to Product Detail Page
 Message "Buy 500 for $87.50 each and save 13%" is shown instead of "Buy 500 for $87.50 each and save 12.5%"

@novikor
Copy link
Contributor Author

novikor commented Dec 22, 2018

@orlangur , please check my fix for displaying correct percentage on frontend.
Also, it seems that someone already fixed this issue in 2.3-develop using explicit float conversion and ?float type hint...

@orlangur
Copy link
Contributor

@novikor as I see it's still ?int in mainline. Please check one more time and resolve conflicts if it makes sense.

@swnsma
Copy link
Contributor

swnsma commented Jan 8, 2019

Merged with MAGETWO-96016.
Refactored to use decomposition instead of inheritance.
Tests coverage added.
PR still contains fix for "Problem: Incorrect percentage value of discount on product page." (should be re-checked).

@orlangur, can you please make review? It will be nice to have it released with MAGETWO-96016 to do not broke backward compatibility.

@orlangur
Copy link
Contributor

@swnsma nice idea of refactoring but need some time to checkout code locally and review, hope to find some spare time this weekend. Please stay tuned!

@okorshenko okorshenko removed this from the Release: 2.3.1 milestone Jan 28, 2019
@swnsma
Copy link
Contributor

swnsma commented Jan 30, 2019

Hi @orlangur
Any updates?)

@sivaschenko
Copy link
Member

Hi @novikor can you please adjust the fix to keep existing classes/hierarchy for backward compatibility reasons.

Display percentage on PDP in case it is set explicitly.
@novikor novikor force-pushed the Tierprice-can-t-save-float-percentage-value-18651 branch from 84cd8cc to 4f318e5 Compare February 16, 2019 13:30
@novikor
Copy link
Contributor Author

novikor commented Feb 16, 2019

@sivaschenko - done. Please recheck.

@ghost ghost unassigned nmalevanec and VasylShvorak May 5, 2019
@novikor
Copy link
Contributor Author

novikor commented May 5, 2019

Fixed.
@nmalevanec , please recheck.

image

@ghost
Copy link

ghost commented May 5, 2019

@novikor unfortunately, only members of the maintainers team are allowed to assign developers to the pull request

@soleksii
Copy link

soleksii commented May 8, 2019

✔️ QA Passed

Result:

after

@m2-assistant
Copy link

m2-assistant bot commented May 14, 2019

Hi @novikor, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Component: Catalog Partner: ISM eCompany Pull Request is created by partner ISM eCompany partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants