From 6dadc1630d5a88dbba69c3d05092a25d21653fd2 Mon Sep 17 00:00:00 2001 From: Andrew Cain Date: Tue, 17 Oct 2023 22:18:46 +1100 Subject: [PATCH] feat: report tii upload action status --- .../tii_action_upload_submission.rb | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/app/models/turn_it_in/tii_action_upload_submission.rb b/app/models/turn_it_in/tii_action_upload_submission.rb index 5f23fb366..716bd5a93 100644 --- a/app/models/turn_it_in/tii_action_upload_submission.rb +++ b/app/models/turn_it_in/tii_action_upload_submission.rb @@ -5,7 +5,7 @@ class TiiActionUploadSubmission < TiiAction delegate :status_sym, :status, :submission_id, :submitted_by_user, :task, :idx, :similarity_pdf_id, :similarity_pdf_path, :filename, to: :entity def description - "Upload #{self.filename} for #{self.task.student.username} from #{self.task.task_definition.abbreviation}" + "Upload #{self.filename} for #{self.task.student.username} from #{self.task.task_definition.abbreviation} (#{self.status} - #{self.next_step})" end # Update the status based on the response from the pdf status api or webhook @@ -88,6 +88,35 @@ def update_from_similarity_status(response) end end + def next_step + case status_sym + when :created + "getting submission id" + when :has_id + "awaiting file upload" + when :uploaded + "awaiting submission processing" + when :submission_complete + "requesting similarity processing" + when :similarity_report_requested + "awaiting similarity report generation" + when :similarity_report_complete + "requesting similarity report" + when :similarity_pdf_requested + "awaiting similarity report" + when :similarity_pdf_available + "downloading similarity report" + when "similarity_pdf_downloaded" + "complete - report available" + when :to_delete + "awaiting deletion" + when :complete_low_similarity + "complete - low similarity" + else + "unknown" + end + end + # Run is designed to be run in a background job, polling in # case of the need to retry actions. This will ensure submissions progress # through turn it in when web hooks fails.