Skip to content

Commit

Permalink
codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-escobedo committed Sep 14, 2022
1 parent 506d873 commit f336096
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
13 changes: 3 additions & 10 deletions lotus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,9 @@
ON_HEROKU = env("ON_HEROKU")
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# local_env_file = BASE_DIR / "env/.env"
# if local_env_file.is_file():
# environ.Env.read_env(local_env_file)
# DOCKERIZED = True
# else:
# DOCKERIZED = False
# global_env_file = BASE_DIR / ".." / "env/.env"
# if global_env_file.is_file():
# environ.Env.read_env(global_env_file)

local_env_file = BASE_DIR / "env/.env"
if local_env_file.is_file():
environ.Env.read_env(local_env_file)

try:
sentry_sdk.init(
Expand Down
14 changes: 9 additions & 5 deletions metering_billing/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,17 @@ def get(self, request, format=None):
}
if all_org_billable_metrics.count() > 0:
for billable_metric in all_org_billable_metrics:
for p_start, p_end, p_num in [(p1_start, p1_end, 1), (p2_start, p2_end, 2)]:
for p_start, p_end, p_num in [
(p1_start, p1_end, 1),
(p2_start, p2_end, 2),
]:
return_dict[f"daily_usage_revenue_period_{p_num}"][
billable_metric.id
] = {
"metric": str(billable_metric),
"data": {
str(x): Decimal(0) for x in dates_bwn_twodates(p_start, p_end)
str(x): Decimal(0)
for x in dates_bwn_twodates(p_start, p_end)
},
"total_revenue": Decimal(0),
}
Expand Down Expand Up @@ -212,9 +216,9 @@ def get(self, request, format=None):
p_start,
p_end,
)
metric_dict = return_dict[f"daily_usage_revenue_period_{p_num}"][
plan_component.billable_metric.id
]
metric_dict = return_dict[
f"daily_usage_revenue_period_{p_num}"
][plan_component.billable_metric.id]
for date, usage_cost in usage_cost_per_day.items():
usage_cost = Decimal(usage_cost)
metric_dict["data"][str(date)] += usage_cost
Expand Down

0 comments on commit f336096

Please sign in to comment.