anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: indico/indico
Issue: Abstract merge: primary author appears twice

If the primary author of both abstracts is the same, they will show up twice in the final abstract.


Changed files:
indico/MaKaC/review.py

diff --git a/indico/MaKaC/review.py b/indico/MaKaC/review.py
index 7345fee1a7..89660f91e9 100644
--- a/indico/MaKaC/review.py
+++ b/indico/MaKaC/review.py
@@ -343,6 +343,15 @@ class Author(AbstractParticipation):
     def isSpeaker(self):
         return self._abstract.isSpeaker(self)
 
+    def __eq__(self, other):
+        return self.getData() == other.getData()
+
+    def __ne__(self, other):
+        return not (self == other)
+
+    def __hash__(self):
+        return hash(frozenset(self.getData().values()))
+
 
 class Submitter(AbstractParticipation):
 
@@ -2094,10 +2103,16 @@ class Abstract(AbstractLegacyMixin, Persistent):
             #    newAuth.setFromAbstractParticipation(auth)
             #    if self.isPrimaryAuthor(auth):
             #        targetAbs.addPrimaryAuthor(newAuth)
+            primary_authors_set = set(targetAbs.getPrimaryAuthorList())
             for auth in self.getPrimaryAuthorList():
+                if auth in primary_authors_set:
+                    continue
                 newAuth=targetAbs.newPrimaryAuthor()
                 newAuth.setFromAbstractParticipation(auth)
+            coauthors_set = set(targetAbs.getCoAuthorList())
             for auth in self.getCoAuthorList():
+                if auth in coauthors_set:
+                    continue
                 newAuth=targetAbs.newCoAuthor()
                 newAuth.setFromAbstractParticipation(auth)