Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
frjo committed Jan 20, 2025
1 parent 81a1f88 commit 61f20a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hypha/apply/determinations/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 4 additions & 3 deletions hypha/apply/determinations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down

0 comments on commit 61f20a5

Please sign in to comment.