fix(event/sync_communication): add distinct while querying communication links

There's cases where these are duplicated

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2023-11-21 13:01:19 +05:30
parent cd189b3f7f
commit da1fb2ff4e
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -121,9 +121,7 @@ class Event(Document):
["Communication Link", "link_doctype", "=", participant.reference_doctype],
["Communication Link", "link_name", "=", participant.reference_docname],
]
comms = frappe.get_all("Communication", filters=filters, fields=["name"])
if comms:
if comms := frappe.get_all("Communication", filters=filters, fields=["name"], distinct=True):
for comm in comms:
communication = frappe.get_doc("Communication", comm.name)
self.update_communication(participant, communication)