grab attachments from correct shard for submission downloads

closes #ADMIN-2751

Change-Id: Ic78a59b5a5cc0b8bae11c19e2b2188d99664db5f
Reviewed-on: https://gerrit.instructure.com/200859
Tested-by: Jenkins
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
James Williams 2019-07-11 10:06:57 -06:00
parent 0f5bd477cd
commit 4fad68a03b
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ module Exporters
# they do not include submissions for group assignments for anyone
# but the original submitter of the group submission
attachment_ids = submission.attachment_ids.try(:split, ",")
attachments = attachment_ids.present? ? Attachment.where(id: attachment_ids) : []
attachments = attachment_ids.present? ? main_sub.shard.activate { Attachment.where(id: attachment_ids) } : []
attachments.each do |attachment|
# TODO handle missing attachments
path = File.join(base_path, attachment.display_name)
@ -47,4 +47,4 @@ module Exporters
end
end
end
end
end

View File

@ -446,7 +446,7 @@ class ContentZipper
# they do not include submissions for group assignments for anyone
# but the original submitter of the group submission
attachment_ids = submission.attachment_ids.try(:split, ",")
Attachment.where(id: Array.wrap(attachment_ids))
submission.shard.activate { Attachment.where(id: Array.wrap(attachment_ids)) }
end
def get_user_name(students, submission)