-
-
Notifications
You must be signed in to change notification settings - Fork 0
Hotfix/discounts #45
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
Hotfix/discounts #45
Conversation
Add PSR logger as a dependency. This allows the application to utilize a standard logging interface, improving interoperability with other logging libraries and frameworks.
Updates the exception message to reflect the correct attribute name. The previous message incorrectly referred to 'ResourceToArray' instead of 'ResourceToPrimaryKey', leading to potential confusion when debugging.
Adds an attribute to format float values with a specific precision when interacting with the API. This ensures consistent and accurate data representation by rounding float values to the desired precision level.
Ensures the discount percentage is formatted with a precision of 2 when sent to the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces a new FloatPrecision attribute for automatic rounding of float values in API responses, applies it to the discountPercentage property in ProductLine, and includes a bug fix and dependency update.
- Added a new
FloatPrecisionattribute that rounds float values to specified decimal places - Applied the attribute to
ProductLine.discountPercentagefor 2-decimal precision - Fixed an incorrect exception message in
ResourceToPrimaryKey
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Attributes/Resources/Properties/ApiFormatting/FloatPrecision.php | New attribute class for rounding float values to specified precision |
| src/DTOs/Invoice/ProductLine.php | Applied FloatPrecision attribute to discountPercentage property |
| src/Attributes/Resources/Properties/ApiFormatting/ResourceToPrimaryKey.php | Fixed exception message to reference correct class name |
| composer.json | Added psr/log dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/Attributes/Resources/Properties/ApiFormatting/FloatPrecision.php
Outdated
Show resolved
Hide resolved
…sion.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…sion.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Adds a missing curly brace to the `FloatPrecision` class. This resolves a syntax error and ensures the class functions as intended.
This pull request introduces a new attribute for formatting float precision in API resources, applies it to the
discountPercentageproperty inProductLine, and makes a minor fix to an exception message. Additionally, it updates dependencies incomposer.json. The most important changes are:New Feature: Float Precision Attribute
FloatPrecisionattribute insrc/Attributes/Resources/Properties/ApiFormatting/FloatPrecision.php, allowing properties to be automatically rounded to a specified precision when formatted for the API.Usage of Float Precision
#[FloatPrecision(2)]attribute to thediscountPercentageproperty in theProductLineDTO, ensuring this value is rounded to two decimal places. [1] [2]Bug Fix
ResourceToPrimaryKeyto reference the correct class name.Dependency Updates
psr/logas a required dependency incomposer.jsonto ensure compatibility with logging interfaces.