From 3cd2644a886e4194de713ca2e826fbf813caefe1 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 17 Jan 2019 14:44:23 -0500 Subject: [PATCH] Use date range for mock data instead of current year only --- atst/domain/csp/reports.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/atst/domain/csp/reports.py b/atst/domain/csp/reports.py index a16fbdcc..3611a45c 100644 --- a/atst/domain/csp/reports.py +++ b/atst/domain/csp/reports.py @@ -296,10 +296,13 @@ class MockReportingProvider(ReportingInterface): else: budget_months = {} - this_year = pendulum.now().year + end = pendulum.now() + start = end.subtract(months=12) + period = pendulum.period(start, end) + all_months = OrderedDict() - for m in range(1, 13): - month_str = "{month:02d}/{year}".format(month=m, year=this_year) + for t in period.range("months"): + month_str = "{month:02d}/{year}".format(month=t.month, year=t.year) all_months[month_str] = budget_months.get(month_str, None) return {"months": all_months}