master courses: avoid unnecessary child tag creation errors

use content_tag_for on creation so we can populate the
@content_tag_index for reuse in the migration

closes #CNVS-38017

Change-Id: Ia1b9fd773f55b4e3dcd068c740896ff0ec6d43e0
Reviewed-on: https://gerrit.instructure.com/122108
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2017-08-09 07:09:23 -06:00
parent a0abc70cc4
commit 39412c857e
2 changed files with 2 additions and 1 deletions

View File

@ -125,7 +125,7 @@ module MasterCourses::Restrictor
def create_child_content_tag
# i thought about making this a bulk insert at the end of the migration but the race conditions seemed scary
if @importing_migration && is_child_content?
@importing_migration.master_course_subscription.create_content_tag_for!(self)
@importing_migration.master_course_subscription.content_tag_for(self)
end
end

View File

@ -46,6 +46,7 @@ module MasterCourses::TagHelper
if content.is_a?(Assignment) && submittable = content.submittable_object
content = submittable # use one child tag
end
return unless content && content.persisted?
if @content_tag_index
tag = (@content_tag_index[content.class.base_class.name] || {})[content.id]