fix: use key consistently

This commit is contained in:
Smit Vora
2026-04-23 15:01:46 +05:30
parent a3ad1fb163
commit 8f9a5e6c0c

View File

@@ -48,8 +48,9 @@ def group_by_party_and_category(data, filters):
party_category_wise_map = {}
for row in data:
key = (row.get("party_type"), row.get("party"), row.get("tax_withholding_category"))
party_category_wise_map.setdefault(
(row.get("party_type"), row.get("party"), row.get("tax_withholding_category")),
key,
{
"pan": row.get("pan"),
"tax_id": row.get("tax_id"),
@@ -64,13 +65,8 @@ def group_by_party_and_category(data, filters):
},
)
party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[
"total_amount"
] += row.get("total_amount", 0.0)
party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[
"tax_amount"
] += row.get("tax_amount", 0.0)
party_category_wise_map.get(key)["total_amount"] += row.get("total_amount", 0.0)
party_category_wise_map.get(key)["tax_amount"] += row.get("tax_amount", 0.0)
final_result = get_final_result(party_category_wise_map)