Skip to content

Commit 26ddafc

Browse files
committed
cost-explorer: fix module
1 parent 0715f6f commit 26ddafc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cost-explorer/src/lambda_function.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
slack_endpoint = os.environ['SLACK_ENDPOINT']
1313
slack_channel = os.environ['SLACK_CHANNEL']
1414

15-
def getDiffrenceInPercent(current, previous, period):
15+
def getDiffrenceInPercent(current, previous, periodArg):
1616
dif = round((current - previous) / previous * 100, 2)
17-
period = "week" if (period == 7) else "month"
18-
result = f"Up *{dif}%* over last {period}" if (dif > 0.0) else f"Down *{-dif}%* over last {period}"
17+
periodArg = "week" if (periodArg == 7) else "month"
18+
result = f"Up *{dif}%* over last {periodArg}" if (dif > 0.0) else f"Down *{-dif}%* over last {periodArg}"
1919
return result
2020

2121
def getCostAndUsage(previous, period):
@@ -51,10 +51,10 @@ def getCostAndUsage(previous, period):
5151

5252
return round(float(cost['ResultsByTime'][0]['Total']['UnblendedCost']['Amount']), 2)
5353

54-
def createPayload(period, slackChannel, currentCost, previousCost):
55-
period = "week" if (period == 7) else "month"
54+
def createPayload(periodArg, slackChannel, currentCost, previousCost):
55+
periodArg = "week" if (periodArg == 7) else "month"
5656

57-
value = f"Total cost over this {period} - *${currentCost}*\nTotal cost over last {period} - *${previousCost}*\n{getDiffrenceInPercent(currentCost, previousCost, period)}"
57+
value = f"Total cost over this {periodArg} - *${currentCost}*\nTotal cost over last {periodArg} - *${previousCost}*\n{getDiffrenceInPercent(currentCost, previousCost, period)}"
5858

5959
payload = {
6060
"channel": slackChannel,

0 commit comments

Comments
 (0)