From 41c7faae29641a3c10e12ab09fcd76be47adeb37 Mon Sep 17 00:00:00 2001 From: nslandolt Date: Wed, 19 Aug 2020 13:27:01 -0300 Subject: [PATCH] just set month to current month --- api/schemas/dmarc_report_summary_table/resolver.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/schemas/dmarc_report_summary_table/resolver.py b/api/schemas/dmarc_report_summary_table/resolver.py index 75004b118..9aea95fb1 100644 --- a/api/schemas/dmarc_report_summary_table/resolver.py +++ b/api/schemas/dmarc_report_summary_table/resolver.py @@ -119,6 +119,10 @@ def resolve_dmarc_report_summary_table(self, info, **kwargs): f"User: {user_id} successfully retrieved the DmarcReportSummaryTable information for all their domains." ) + if period == 'last30days': + current_month = int(datetime.today().month) + period = calendar.month_abbr[current_month] + return DmarcReportSummaryTable( # Get Month Name datetime.strptime(period.lower(), "%b").strftime("%B"), @@ -129,6 +133,9 @@ def resolve_dmarc_report_summary_table(self, info, **kwargs): def resolve_demo_dmarc_report_summary_table(self, info, **kwargs): + period = cleanse_input(kwargs.get("period")) + year = cleanse_input(kwargs.get("year")) + data_list = [] faked_data = [ {"domain": "test.gc.ca", "data": api_return_data_1}, @@ -142,6 +149,9 @@ def resolve_demo_dmarc_report_summary_table(self, info, **kwargs): temp_dict.update({"domain": data.get("domain")}) data_list.append(temp_dict) + if period == 'last30days': + period = calendar.month_abbr(datetime.today().month()) + return DmarcReportSummaryTable( # Get Month Name datetime.strptime(period.lower(), "%b").strftime("%B"),