Skip to content

Commit

Permalink
Remove try-except block
Browse files Browse the repository at this point in the history
  • Loading branch information
hnryjmes committed Feb 13, 2024
1 parent 9f2656e commit 5bcaa05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions api/cases/tests/test_case_ecju_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from api.audit_trail.serializers import AuditSerializer
from api.cases.enums import ECJUQueryType
from api.cases.models import EcjuQuery
from api.core.exceptions import NotFoundError
from api.compliance.tests.factories import ComplianceSiteCaseFactory
from api.licences.enums import LicenceStatus
from api.licences.tests.factories import StandardLicenceFactory
Expand Down
17 changes: 7 additions & 10 deletions api/cases/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,18 +646,15 @@ def put(self, request, pk, ecju_pk):
payload={"ecju_response": data.get("response")},
)

# if an exporter responds to a query, create a mention notification
# If an exporter responds to a query, create a mention notification
# for the case worker that lets them know the query has been responded to
if not is_govuser_request:
try:
exporter_user_full_name = ExporterUser.objects.get(baseuser_ptr_id=request.user.pk).full_name
create_system_mention(
case=ecju_query.case,
case_note_text=f"{exporter_user_full_name} has responded to a query.",
mention_user=ecju_query.raised_by_user,
)
except ExporterUser.DoesNotExist:
raise NotFoundError({"user": f"ExporterUser not found for pk: {request.user.pk}"})
exporter_user_full_name = ExporterUser.objects.get(baseuser_ptr_id=request.user.pk).full_name
create_system_mention(
case=ecju_query.case,
case_note_text=f"{exporter_user_full_name} has responded to a query.",
mention_user=ecju_query.raised_by_user,
)

return JsonResponse(data={"ecju_query": serializer.data}, status=status.HTTP_200_OK)

Expand Down

0 comments on commit 5bcaa05

Please sign in to comment.