Skip to content

Commit

Permalink
Fix use of oxford comma
Browse files Browse the repository at this point in the history
  • Loading branch information
amickan committed Oct 16, 2024
1 parent 9358806 commit 58d68b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions app/grandchallenge/cases/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,19 @@ def update_status(

if self.error_message and self.creator:
if detailed_error_message:
notification_description = [
f"Image validation for {key} failed with error: {val}. "
for key, val in detailed_error_message.items()
]
notification_description = oxford_comma(
[
f"Image validation for {key} failed with error: {val}. "
for key, val in detailed_error_message.items()
]
)
else:
notification_description = error_message

Notification.send(
kind=NotificationType.NotificationTypeChoices.IMAGE_IMPORT_STATUS,
message=error_message,
description=oxford_comma(notification_description),
description=notification_description,
action_object=self,
)

Expand Down
12 changes: 7 additions & 5 deletions app/grandchallenge/uploads/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ def handle_file_validation_failure(
self, *, error_message, detailed_error_message=None, linked_object=None
):
if detailed_error_message:
notification_description = [
f"File validation for {key} failed with error: {val}. "
for key, val in detailed_error_message.items()
]
notification_description = oxford_comma(
[
f"File validation for {key} failed with error: {val}. "
for key, val in detailed_error_message.items()
]
)
else:
notification_description = error_message

Expand All @@ -97,7 +99,7 @@ def handle_file_validation_failure(
actor=self.creator,
message=error_message,
target=linked_object.base_object,
description=oxford_comma(notification_description),
description=notification_description,
)
if linked_object and hasattr(linked_object, "update_status"):
linked_object.update_status(
Expand Down

0 comments on commit 58d68b9

Please sign in to comment.