From 38ee67498c4e2a8b46b1c530f72f84c56e167673 Mon Sep 17 00:00:00 2001 From: markallanson Date: Sun, 7 Feb 2021 09:51:14 +0000 Subject: [PATCH] Fix bug incorrect transposing inc and exc vat rates --- octopus_energy/mappers.py | 2 +- pyproject.toml | 2 +- .../mapping_results/tariff_rate_mapping.json | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/octopus_energy/mappers.py b/octopus_energy/mappers.py index 1350eca..52babae 100644 --- a/octopus_energy/mappers.py +++ b/octopus_energy/mappers.py @@ -159,8 +159,8 @@ def tariff_rates_from_response(response: dict) -> List[TariffRate]: return [] return [ TariffRate( - Decimal(result["value_exc_vat"]).quantize(_QUANT_3DP, rounding=ROUND_DOWN), Decimal(result["value_inc_vat"]).quantize(_QUANT_3DP, rounding=ROUND_DOWN), + Decimal(result["value_exc_vat"]).quantize(_QUANT_3DP, rounding=ROUND_DOWN), from_timestamp_str(result["valid_from"]), from_timestamp_str(result.get("valid_to", None)), ) diff --git a/pyproject.toml b/pyproject.toml index 853f376..e0ae039 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "octopus-energy" -version = "0.1.12" +version = "0.1.13" description = "Python client for the Octopus Energy RESTful API" authors = ["Mark Allanson "] license = "MIT" diff --git a/tests/mapping_results/tariff_rate_mapping.json b/tests/mapping_results/tariff_rate_mapping.json index 0a7dae9..76dd82b 100644 --- a/tests/mapping_results/tariff_rate_mapping.json +++ b/tests/mapping_results/tariff_rate_mapping.json @@ -8,7 +8,7 @@ }, { "py/tuple": [ - "20.640" + "21.672" ] } ] @@ -20,7 +20,7 @@ }, { "py/tuple": [ - "21.672" + "20.640" ] } ] @@ -74,7 +74,7 @@ }, { "py/tuple": [ - "18.460" + "19.382" ] } ] @@ -86,7 +86,7 @@ }, { "py/tuple": [ - "19.382" + "18.460" ] } ] @@ -129,7 +129,7 @@ }, { "py/tuple": [ - "18.460" + "19.382" ] } ] @@ -141,7 +141,7 @@ }, { "py/tuple": [ - "19.382" + "18.460" ] } ] @@ -184,7 +184,7 @@ }, { "py/tuple": [ - "18.460" + "19.382" ] } ] @@ -196,7 +196,7 @@ }, { "py/tuple": [ - "19.382" + "18.460" ] } ] @@ -239,7 +239,7 @@ }, { "py/tuple": [ - "18.000" + "18.899" ] } ] @@ -251,7 +251,7 @@ }, { "py/tuple": [ - "18.899" + "18.000" ] } ]