Add some comments to clarify outcome_response_processor

Refs PLAT-5389
flag=none

Test Plan:
Verify comments are clear and free
of spelling errors

Change-Id: I4a9031405fa02f2f00170b38c39668a6b9787570
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/233540
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
This commit is contained in:
wdransfield 2020-04-09 12:14:57 -06:00 committed by Weston Dransfield
parent fd46ea3a6f
commit c7576cd2b4
1 changed files with 24 additions and 0 deletions

View File

@ -33,10 +33,33 @@ module Turnitin
end end
def process def process
# Create an attachment for the file submitted via the TII tool.
# If the score is still pending, this will raise
# `Errors::ScoreStillPendingError`
attachment = AttachmentManager.create_attachment(@user, @assignment, @tool, @outcomes_response_json) attachment = AttachmentManager.create_attachment(@user, @assignment, @tool, @outcomes_response_json)
# If we've made it this far, we've successfully
# retrieved an attachment from TII
asset_string = attachment.asset_string asset_string = attachment.asset_string
# Create a submission using the attachment
submission = submit_homework(attachment) submission = submit_homework(attachment)
# Set submission processing status to "pending"
update_turnitin_data!(submission, asset_string, status: 'pending', outcome_response: @outcomes_response_json) update_turnitin_data!(submission, asset_string, status: 'pending', outcome_response: @outcomes_response_json)
# Start a job that attempts to retrieve the
# score from TII.
#
# If no score is available yet, this job
# will terminate and retry up to
# the max_attempts limit
#
# TODO: This job does not use any kind of
# exponential backoff. We should add
# one to give TII more time to process
# attachments.
self.send_later_enqueue_args( self.send_later_enqueue_args(
:update_originality_data, :update_originality_data,
{max_attempts: self.class.max_attempts}, {max_attempts: self.class.max_attempts},
@ -86,6 +109,7 @@ module Turnitin
InstStatsd::Statsd.increment("submission_not_scored.account_#{@assignment.root_account.global_id}", InstStatsd::Statsd.increment("submission_not_scored.account_#{@assignment.root_account.global_id}",
short_stat: 'submission_not_scored', short_stat: 'submission_not_scored',
tags: { root_account_id: @assignment.root_account.global_id }) tags: { root_account_id: @assignment.root_account.global_id })
# Retry the update_originality_data job
raise Errors::SubmissionNotScoredError raise Errors::SubmissionNotScoredError
else else
new_data = { new_data = {