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

AmountOff percentage is cast to an int, even though it could contain a decimal value #2003

Closed
tvlokven opened this issue Oct 25, 2024 · 0 comments · Fixed by #2004
Closed
Labels
bug Something isn't working unconfirmed

Comments

@tvlokven
Copy link
Contributor

The admin panel allows you to enter a decimal value when creating an AmountOff Discount with a percentage discount. However, it gets cast to an int in the AmountOff class, which results in the percentage being rounded and the discount amount being slightly off.

You could argue that usually percentage discounts are given as whole numbers, but since the admin panel already supports decimal values, I think this should be changed.

I'll include a PR to address this.

@tvlokven tvlokven added bug Something isn't working unconfirmed labels Oct 25, 2024
tvlokven pushed a commit to tvlokven/lunar that referenced this issue Oct 25, 2024
alecritson added a commit that referenced this issue Nov 5, 2024
#2004)

The admin panel allows you to enter a decimal value when creating an
AmountOff Discount with a percentage discount. However, it gets cast to
an int in the AmountOff class, which results in the percentage being
rounded and the discount amount being slightly off.

You could argue that usually percentage discounts are given as whole
numbers, but since the admin panel already supports decimal values, I
think this should be changed.

Fixes #2003

---------

Co-authored-by: tim <tim@direct-effect.nl>
Co-authored-by: Author <actions@github.com>
Co-authored-by: Alec Ritson <hello@itsalec.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant