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

Fixed the index_id #791

Merged
merged 1 commit into from
Jun 3, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __get_analysed_reports(self):
if Utils.equal_ignore_case(cloud_name, 'amazon'):
cloud_name = 'AWS'
month = datetime.datetime.strftime(timestamp, '%Y %b')
index_id = f"""{account.get('date')}-{account.get('vendor_account_name').lower()}"""
index_id = f"""cloudability-{account.get('date')}-{account.get('vendor_account_name').lower()}"""

if year in account.get('date'):
if index_id not in cost_reports:
Expand All @@ -124,7 +124,7 @@ def __get_analysed_reports(self):
'start_date': account.get('date'),
'CloudName': cloud_name,
'Forecast': 0,
'index_id': f"""{account.get('date')}-{account.get('vendor_account_name').lower()}""",
'index_id': index_id,
'timestamp': timestamp,
'Month': month,
'Budget': round(account_budget / MONTHS, DEFAULT_ROUND_DIGITS),
Expand All @@ -133,8 +133,7 @@ def __get_analysed_reports(self):
'filter_date': f'{account.get("date")}-{month.split()[-1]}'
})
else:
cost_reports[index_id]['Actual'] += round(float(account.get('unblended_cost')),
DEFAULT_ROUND_DIGITS)
cost_reports[index_id]['Actual'] += round(float(account.get('unblended_cost')), DEFAULT_ROUND_DIGITS)
return list(cost_reports.values())

def __next_twelve_months(self):
Expand Down Expand Up @@ -177,7 +176,7 @@ def __forecast_for_next_months(self, cost_data: list):
m, y = m_y[0], m_y[1]
start_date = f'{y}-{m}-01'
timestamp = datetime.datetime.strptime(start_date, "%Y-%m-%d")
index_id = f'{start_date}-{data.get("Account").lower()}'
index_id = f'cloudability-{start_date}-{data.get("Account").lower()}'
month = datetime.datetime.strftime(timestamp, "%Y %b")
forecast_cost_data.append({
**data,
Expand Down
Loading