diff --git a/hypha/apply/determinations/tests/test_views.py b/hypha/apply/determinations/tests/test_views.py index 4f81b79779..bf831185e6 100644 --- a/hypha/apply/determinations/tests/test_views.py +++ b/hypha/apply/determinations/tests/test_views.py @@ -508,9 +508,9 @@ def test_message_created_if_determination_exists(self): self.assertEqual(submissions[1].determinations.count(), 1) self.assertEqual(submissions[1].determinations.first().outcome, REJECTED) - # 5 base - 2 x django messages, 1 x activity feed, 1 x email, 1 x slack + # 5 base - 1 x django messages, 1 x activity feed, 1 x email, 1 x slack # plus 1 extra for unable to determine - self.assertEqual(len(response.context["messages"]), 6) + self.assertEqual(len(response.context["messages"]), 5) class UserDeterminationFormTestCase(BaseViewTestCase): diff --git a/hypha/apply/determinations/views.py b/hypha/apply/determinations/views.py index c42e682b70..cd7e2d7301 100644 --- a/hypha/apply/determinations/views.py +++ b/hypha/apply/determinations/views.py @@ -201,18 +201,19 @@ def form_valid(self, form): determination.submission.id: determination for determination in form.instances } + sources = submissions.filter(id__in=list(determinations)) base_message = _("Successfully determined as {outcome}: ").format( - outcome=determinations[submissions[0].id].clean_outcome + outcome=determinations[sources[0].id].clean_outcome ) - submissions_text = [submission.title_text_display for submission in submissions] + submissions_text = [submission.title_text_display for submission in sources] messages.success(self.request, base_message + ", ".join(submissions_text)) messenger( MESSAGES.BATCH_DETERMINATION_OUTCOME, request=self.request, user=self.request.user, - sources=submissions.filter(id__in=list(determinations)), + sources=sources, related=determinations, )