Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adit/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def post(self, request: AuthenticatedHttpRequest, *args, **kwargs) -> HttpRespon
queued_job_id = dicom_task.queued_job_id
if queued_job_id is not None:
app.job_manager.cancel_job_by_id(queued_job_id, delete_job=True)
tasks.update(status=DicomTask.Status.CANCELED)
tasks.update(status=DicomTask.Status.CANCELED, message="Task manually canceled")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While adding a cancellation message is a good idea, hardcoding the string here is not ideal for maintainability. It would be better to define this message as a constant on the DicomTask model (e.g., DicomTask.MANUALLY_CANCELED_MESSAGE) and reference it here. This makes the message reusable and easier to manage if it needs to be changed in the future.

if job.tasks.filter(status=DicomTask.Status.IN_PROGRESS).exists():
job.status = DicomJob.Status.CANCELING
Expand Down