[damned-lies] Forgot distinct() in involved_person branch



commit b9058c0fb598136199a5b936065d0a0ab21831b7
Author: Claude Paroz <claude 2xlibre net>
Date:   Sun Mar 4 21:01:36 2018 +0100

    Forgot distinct() in involved_person branch

 vertimus/models.py      |    2 +-
 vertimus/tests/tests.py |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/vertimus/models.py b/vertimus/models.py
index d1bb3ae..02b618e 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -112,7 +112,7 @@ class State(models.Model):
         Return all persons having posted any action on the current state.
         """
         if extra_user is not None:
-            return Person.objects.filter(Q(action__state_db=self) | Q(pk=extra_user.pk))
+            return Person.objects.filter(Q(action__state_db=self) | Q(pk=extra_user.pk)).distinct()
         return Person.objects.filter(action__state_db=self).distinct()
 
     def get_latest_po_file_action(self):
diff --git a/vertimus/tests/tests.py b/vertimus/tests/tests.py
index 8bb7c08..95a93c6 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -422,6 +422,12 @@ class VertimusTest(TeamsAndRolesTests):
         self.b.module.save()
         state = StateProofreading(branch=self.b, domain=self.d, language=self.l, person=pers)
         state.save()
+        # Adding two comments from the commit author, as this might trigger a form error
+        action = Action.new_by_name('WC', person=self.pcoo)
+        action.apply_on(state, {'send_to_ml': False, 'comment': "Looks good"})
+        action = Action.new_by_name('WC', person=self.pcoo)
+        action.apply_on(state, {'send_to_ml': False, 'comment': "Looks good too"})
+
         self.upload_file(state, 'UP', pers=pers)
         post_data = {
             'action': 'CI',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]