From d85d0ceb90d68382bade054aedd76a969bbb938e Mon Sep 17 00:00:00 2001 From: Eva Sebestova Date: Mon, 19 Aug 2024 14:49:22 +0200 Subject: [PATCH 1/2] Adjust savings plan rate to match cost and usage --- nise/__init__.py | 2 +- nise/generators/aws/data_transfer_generator.py | 2 +- nise/generators/aws/ec2_generator.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nise/__init__.py b/nise/__init__.py index 5e6604d0..1555d212 100644 --- a/nise/__init__.py +++ b/nise/__init__.py @@ -1,4 +1,4 @@ -__version__ = "4.6.9" +__version__ = "4.6.10" VERSION = __version__.split(".") diff --git a/nise/generators/aws/data_transfer_generator.py b/nise/generators/aws/data_transfer_generator.py index 5477eeaa..426c56c9 100644 --- a/nise/generators/aws/data_transfer_generator.py +++ b/nise/generators/aws/data_transfer_generator.py @@ -116,7 +116,7 @@ def _update_data(self, row, start, end, **kwargs): row["pricing/term"] = "OnDemand" row["pricing/unit"] = "GB" row["savingsPlan/SavingsPlanEffectiveCost"] = str(saving) - row["savingsPlan/SavingsPlanRate"] = str(saving) + row["savingsPlan/SavingsPlanRate"] = str(round(float(saving) / amount, 4)) if saving else str(saving) # Overwrite lineItem/LineItemType for items with applied Savings plan if saving is not None: diff --git a/nise/generators/aws/ec2_generator.py b/nise/generators/aws/ec2_generator.py index a8b60e42..b39788a2 100644 --- a/nise/generators/aws/ec2_generator.py +++ b/nise/generators/aws/ec2_generator.py @@ -198,7 +198,7 @@ def _update_data(self, row, start, end, **kwargs): row["pricing/term"] = "OnDemand" row["pricing/unit"] = "Hrs" row["savingsPlan/SavingsPlanEffectiveCost"] = saving - row["savingsPlan/SavingsPlanRate"] = saving + row["savingsPlan/SavingsPlanRate"] = round(float(saving) / float(amount), 5) if saving and amount else saving # Overwrite lineItem/LineItemType for items with applied Savings plan if saving is not None: From ab2f2a26243afe5842ab89fc6cad619601b4a333 Mon Sep 17 00:00:00 2001 From: Eva Sebestova Date: Mon, 19 Aug 2024 14:51:44 +0200 Subject: [PATCH 2/2] update rounding --- nise/generators/aws/ec2_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nise/generators/aws/ec2_generator.py b/nise/generators/aws/ec2_generator.py index b39788a2..d48cd6dc 100644 --- a/nise/generators/aws/ec2_generator.py +++ b/nise/generators/aws/ec2_generator.py @@ -198,7 +198,7 @@ def _update_data(self, row, start, end, **kwargs): row["pricing/term"] = "OnDemand" row["pricing/unit"] = "Hrs" row["savingsPlan/SavingsPlanEffectiveCost"] = saving - row["savingsPlan/SavingsPlanRate"] = round(float(saving) / float(amount), 5) if saving and amount else saving + row["savingsPlan/SavingsPlanRate"] = round(float(saving) / float(amount), 4) if saving and amount else saving # Overwrite lineItem/LineItemType for items with applied Savings plan if saving is not None: