Skip to content

Commit

Permalink
feat: report tii upload action status
Browse files Browse the repository at this point in the history
  • Loading branch information
macite committed Oct 17, 2023
1 parent 6c295aa commit 60d844a
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion app/models/turn_it_in/tii_action_upload_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 60d844a

Please sign in to comment.