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

#89 - Fixed rounding issue on change_scale with 10 value. #91

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.4.2] - In progress...

### Fixed
- [#87](https://github.com/brunohjs/rasa-model-report/issues/87) - Fixed wrong element counting on `Element count` section.
- [#87](https://github.com/brunohjs/rasa-model-report/issues/87) Fixed wrong element counting on `Element count` section.
- [#89](https://github.com/brunohjs/rasa-model-report/issues/89) Fixed rounding issue on `change_scale` with `10` value.

## [1.4.1] - 2023-10-09

Expand Down
2 changes: 1 addition & 1 deletion rasa_model_report/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
RASA_PATH = "./"
RASA_VERSION = None
EXCLUDE = []
VERSION = "1.4.2b13"
VERSION = "1.4.2b14"
2 changes: 1 addition & 1 deletion rasa_model_report/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def change_scale(value: float, scale: int = 1, precision: int = 1) -> str:
isinstance(scale, (float, int)) and
scale != 0
):
new_value = value * scale
new_value = round(value * scale, precision)
if new_value >= 1 and new_value % int(new_value) == 0:
return str(int(new_value))
elif new_value < 1 and re.search(r"\.0$", f"{new_value:.{precision}f}"):
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_get_project_name(args, expected):

# Other precisions
({"value": 10, "scale": 1, "precision": 2}, "10"),
({"value": 0.9999973454492488, "scale": 10, "precision": 2}, "10"),
({"value": 39.591231, "scale": 1, "precision": 2}, "39.59"),
({"value": 0.05281239, "scale": 1, "precision": 1}, "0.1"),
({"value": 0.5219483, "scale": 10, "precision": 2}, "5.22"),
Expand Down
Loading