From c72ba2c7b8529b4d759af2aa4e2be986539c2f9e Mon Sep 17 00:00:00 2001 From: hannesdiedrich Date: Mon, 4 Mar 2024 09:14:37 +0100 Subject: [PATCH] FE-478: Increase number of digits for rounding the results for the UI --- gsy_framework/utils.py | 2 +- tests/test_bills.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gsy_framework/utils.py b/gsy_framework/utils.py index 2413465b..8cdf13ee 100644 --- a/gsy_framework/utils.py +++ b/gsy_framework/utils.py @@ -344,7 +344,7 @@ def get_area_uuid_name_mapping(area_dict, results): def round_floats_for_ui(number): """Round the given number using the scale required by the UI.""" - return round(number, 3) + return round(number, 5) def round_prices_to_cents(number): diff --git a/tests/test_bills.py b/tests/test_bills.py index a7c9f9ce..a23f349e 100644 --- a/tests/test_bills.py +++ b/tests/test_bills.py @@ -152,7 +152,7 @@ def test_round_results_for_ui(self): uuid_results["2345"]["pv"]["sold"] = 0.987 uuid_results["6789"]["earned"] = 12 results = self.bills._round_results_for_ui(uuid_results) - assert results["1234"]["house1"]["bought"] == 0.123 - assert results["1234"]["house2"]["sold"] == 0.988 + assert results["1234"]["house1"]["bought"] == 0.12346 + assert results["1234"]["house2"]["sold"] == 0.98765 assert results["2345"]["pv"]["sold"] == 0.987 assert results["6789"]["earned"] == 12