From 3d00a9603181b1c0fcb71c724e747f94a1720046 Mon Sep 17 00:00:00 2001 From: Matt Travers Date: Thu, 30 Nov 2023 17:33:22 -0500 Subject: [PATCH] Refactor summary handling of SA11aI and SA11aII --- .../fecfiler/web_services/summary/summary.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/django-backend/fecfiler/web_services/summary/summary.py b/django-backend/fecfiler/web_services/summary/summary.py index 094423d7e4..4eb661249c 100644 --- a/django-backend/fecfiler/web_services/summary/summary.py +++ b/django-backend/fecfiler/web_services/summary/summary.py @@ -22,8 +22,8 @@ def calculate_summary(self): def calculate_summary_column_a(self): report_transactions = Transaction.objects.filter(report=self.report) summary = report_transactions.aggregate( - line_11ai=self.get_line("SA11AI", itemized=True), - line_11aii=self.get_line("SA11AI", itemized=False), + line_11ai=self.get_line("SA11AI"), + line_11aii=self.get_line("SA11AII"), line_11b=self.get_line("SA11B"), line_11c=self.get_line("SA11C"), line_12=self.get_line("SA12"), @@ -174,8 +174,8 @@ def calculate_summary_column_b(self): # build summary summary = ytd_transactions.aggregate( - line_11ai=self.get_line("SA11AI", itemized=True), - line_11aii=self.get_line("SA11AI", itemized=False), + line_11ai=self.get_line("SA11AI"), + line_11aii=self.get_line("SA11AII"), line_11b=self.get_line("SA11B"), line_11c=self.get_line("SA11C"), line_12=self.get_line("SA12"), @@ -297,10 +297,6 @@ def calculate_summary_column_b(self): return summary - def get_line(self, form_type, field="amount", itemized=None): - query = ( - Q(~Q(memo_code=True), itemized=itemized, _form_type=form_type) - if itemized is not None - else Q(~Q(memo_code=True), _form_type=form_type) - ) + def get_line(self, form_type, field="amount"): + query = Q(~Q(memo_code=True), form_type=form_type) return Coalesce(Sum(field, filter=query), Decimal(0.0))