bump nokogiri
and gems that have strict dependencies on it needed to rework BasicLTI::BasicOutcomes to avoid YAML serializing Nokogiri::XML objects, since it will now raise an exception when trying to deserialize. it didn't need them before, I just needed to adjust the call to be a class method to avoid bringing along the unnecessary context also, nokogumbo was folded into nokogiri as of 1.12, so no need to have it explicitly Change-Id: I6f95ee897f4764b9703d4f09ff3182710a267c6f Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274652 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Jacob Burroughs <jburroughs@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
b51882648f
commit
5deb17ec1c
|
@ -61,14 +61,14 @@ gem 'browser', '5.1.0', require: false
|
|||
gem 'builder', '3.2.4'
|
||||
gem 'business_time', '0.10.0'
|
||||
gem 'canvas_connect', '0.3.14'
|
||||
gem 'adobe_connect', '1.0.9', require: false
|
||||
gem 'adobe_connect', '1.0.10', require: false
|
||||
gem 'canvas_webex', '0.18.1'
|
||||
gem 'crocodoc-ruby', '0.0.1', require: false
|
||||
gem 'ddtrace', '0.42.0', require: false
|
||||
gem 'encrypted_cookie_store-instructure', '1.2.11', require: 'encrypted_cookie_store'
|
||||
gem 'folio-pagination', '0.0.12', require: 'folio/rails'
|
||||
gem 'ffi', '1.13.1', require: false
|
||||
gem 'gepub', '1.0.13'
|
||||
gem 'gepub', '1.0.15'
|
||||
gem 'apollo-federation', '1.1.5'
|
||||
gem 'graphql', '1.12.14'
|
||||
gem 'graphql-batch', '0.4.3'
|
||||
|
@ -108,8 +108,7 @@ gem 'mime-types', '3.3.1'
|
|||
gem 'mini_magick', '4.11.0'
|
||||
gem 'multi_json', '1.15.0'
|
||||
gem 'net-ldap', '0.16.3', require: false
|
||||
gem 'nokogiri', '1.11.5', require: false
|
||||
gem 'nokogumbo', '2.0.4'
|
||||
gem 'nokogiri', '1.12.5', require: false
|
||||
gem 'oauth', '0.5.4', require: false
|
||||
gem 'oauth2', '1.4.4', require: false
|
||||
gem 'oj', '3.10.16'
|
||||
|
@ -120,7 +119,7 @@ gem 'rack-brotli', '1.0.0'
|
|||
gem 'rack-test', '1.1.0'
|
||||
gem 'rake', '13.0.3'
|
||||
gem 'rails-observers', '0.1.5'
|
||||
gem 'ratom-nokogiri', '0.10.10', require: false
|
||||
gem 'ratom-nokogiri', '0.10.11', require: false
|
||||
gem 'redcarpet', '3.5.0', require: false
|
||||
gem 'retriable', '1.4.1'
|
||||
gem 'ritex', '1.0.1', require: false
|
||||
|
@ -129,7 +128,7 @@ gem 'ruby-duration', '3.2.3', require: false
|
|||
gem 'ruby2_keywords', '0.0.3'
|
||||
gem 'rubycas-client', '2.3.9', require: false
|
||||
gem 'rubyzip', '2.3.0', require: 'zip'
|
||||
gem 'saml2', '3.1.0'
|
||||
gem 'saml2', '3.1.1'
|
||||
gem 'nokogiri-xmlsec-instructure', '0.10.1', require: false
|
||||
gem 'sanitize', '5.2.3', require: false
|
||||
gem 'sentry-raven', '2.13.0', require: false
|
||||
|
|
|
@ -206,6 +206,38 @@ module BasicLTI
|
|||
yield if block_given? && !(submission&.grader_id && submission.grader_id > 0 && prioritize_non_tool_grade)
|
||||
end
|
||||
|
||||
def self.create_homework_submission(submission_hash, assignment, user)
|
||||
submission = assignment.submit_homework(user, submission_hash.clone) if submission_hash[:submission_type].present?
|
||||
submission = assignment.grade_student(user, submission_hash).first if submission_hash[:grade].present?
|
||||
submission
|
||||
end
|
||||
|
||||
def self.fetch_attachment_and_save_submission(url, attachment, submission_hash, assignment, user, attempt_number = 0)
|
||||
failed_retryable = attachment.clone_url(url, 'rename', true)
|
||||
if failed_retryable && ((attempt_number += 1) < MAX_ATTEMPTS)
|
||||
# Exits out of the first job and creates a second one so that the run_at time won't hold back
|
||||
# the entire n_strand. Also creates it in a different strand for retries, so we shouldn't block
|
||||
# any incoming uploads.
|
||||
job_options = {
|
||||
priority: Delayed::HIGH_PRIORITY,
|
||||
# because inst-jobs only takes 2 items from an array to make a string strand
|
||||
# name and this uses 3
|
||||
n_strand: (Attachment.clone_url_strand(url) << 'failed').join('/'),
|
||||
run_at: Time.now.utc + (attempt_number**4) + 5
|
||||
}
|
||||
delay(**job_options).fetch_attachment_and_save_submission(
|
||||
url,
|
||||
attachment,
|
||||
submission_hash,
|
||||
assignment,
|
||||
user,
|
||||
attempt_number
|
||||
)
|
||||
else
|
||||
create_homework_submission submission_hash, assignment, user
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength
|
||||
|
@ -310,15 +342,16 @@ module BasicLTI
|
|||
n_strand: Attachment.clone_url_strand(url)
|
||||
}
|
||||
|
||||
delay(**job_options).fetch_attachment_and_save_submission(
|
||||
self.class.delay(**job_options).fetch_attachment_and_save_submission(
|
||||
url,
|
||||
attachment,
|
||||
submission_hash,
|
||||
assignment,
|
||||
user
|
||||
)
|
||||
else
|
||||
create_homework_submission submission_hash, assignment, user
|
||||
elsif !(@submission = self.class.create_homework_submission(submission_hash, assignment, user))
|
||||
self.code_major = 'failure'
|
||||
self.description = I18n.t('lib.basic_lti.no_submission_created', 'This outcome request failed to create a new homework submission.')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -328,16 +361,6 @@ module BasicLTI
|
|||
end
|
||||
# rubocop:enable Metrics/PerceivedComplexity, Metrics/MethodLength
|
||||
|
||||
def create_homework_submission(submission_hash, assignment, user)
|
||||
@submission = assignment.submit_homework(user, submission_hash.clone) if submission_hash[:submission_type].present?
|
||||
@submission = assignment.grade_student(user, submission_hash).first if submission_hash[:grade].present?
|
||||
|
||||
unless @submission
|
||||
self.code_major = 'failure'
|
||||
self.description = I18n.t('lib.basic_lti.no_submission_created', 'This outcome request failed to create a new homework submission.')
|
||||
end
|
||||
end
|
||||
|
||||
def handle_delete_result(tool, assignment, user)
|
||||
assignment.grade_student(user, :grade => nil, grader_id: -tool.id)
|
||||
self.body = "<deleteResultResponse />"
|
||||
|
@ -359,34 +382,6 @@ module BasicLTI
|
|||
true
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/ParameterLists
|
||||
def fetch_attachment_and_save_submission(url, attachment, submission_hash, assignment, user, attempt_number = 0)
|
||||
failed_retryable = attachment.clone_url(url, 'rename', true)
|
||||
if failed_retryable && ((attempt_number += 1) < MAX_ATTEMPTS)
|
||||
# Exits out of the first job and creates a second one so that the run_at time won't hold back
|
||||
# the entire n_strand. Also creates it in a different strand for retries, so we shouldn't block
|
||||
# any incoming uploads.
|
||||
job_options = {
|
||||
priority: Delayed::HIGH_PRIORITY,
|
||||
# because inst-jobs only takes 2 items from an array to make a string strand
|
||||
# name and this uses 3
|
||||
n_strand: (Attachment.clone_url_strand(url) << 'failed').join('/'),
|
||||
run_at: Time.now.utc + (attempt_number**4) + 5
|
||||
}
|
||||
delay(**job_options).fetch_attachment_and_save_submission(
|
||||
url,
|
||||
attachment,
|
||||
submission_hash,
|
||||
assignment,
|
||||
user,
|
||||
attempt_number
|
||||
)
|
||||
else
|
||||
create_homework_submission submission_hash, assignment, user
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics/ParameterLists
|
||||
|
||||
def submission_score
|
||||
if @submission.try(:graded?)
|
||||
raw_score = @submission.assignment.score_to_grade_percent(@submission.score)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#
|
||||
|
||||
require 'nokogiri'
|
||||
require 'nokogumbo'
|
||||
|
||||
module CC
|
||||
module CCHelper
|
||||
|
|
Loading…
Reference in New Issue