Skip to content

Commit

Permalink
Fix duplicates being added to the XML
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed May 24, 2024
1 parent cedd6b7 commit 37b10ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/donations/views/donations_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,16 @@ def _build_xml(
# 02. XML header
xml_str += _build_xml_header(ngo, batch_count, zip_timestamp)

# 03. XML body (duplicates were already removed)
# 03. XML body
for donation_idx, donation in enumerate(donations_batch):
# skip donations which have a duplicate CNP from the XML
cnp = donation.get_cnp()
if cnp in cnp_idx and cnp_idx[cnp]["has_duplicate"]:
if not cnp_idx[cnp].get("skip", False):
cnp_idx[cnp]["skip"] = True
else:
continue

xml_str += _build_xml_donation_content(donation, donation_idx, ngo)

# 04. XML closing tag
Expand Down

0 comments on commit 37b10ec

Please sign in to comment.