Module: Course::DuplicationConcern

Extended by:
ActiveSupport::Concern
Included in:
Course
Defined in:
app/models/concerns/course/duplication_concern.rb

Instance Method Summary collapse

Instance Method Details

#course_duplicable?Boolean

Override this method to prevent duplication of the course as a whole

Returns:

  • (Boolean)

37
38
39
# File 'app/models/concerns/course/duplication_concern.rb', line 37

def course_duplicable?
  true
end

#disabled_cherrypickable_typesArray<Class>

Override this method to prevent certain items from being cherry-picked for duplication for the current course. See ObjectDuplicationsHelper for list of cherrypickable items.

Returns:

  • (Array<Class>)

    Classes of disabled items


50
51
52
# File 'app/models/concerns/course/duplication_concern.rb', line 50

def disabled_cherrypickable_types
  []
end

#duplication_manifestObject

List of top-level items that need to be duplicated for the whole course to be considered duplicated.


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/concerns/course/duplication_concern.rb', line 16

def duplication_manifest # rubocop:disable Metrics/MethodLength
  [
    *material_folders.concrete,
    *materials.in_concrete_folder,
    *levels,
    *assessment_categories,
    *assessment_tabs,
    *assessments,
    *assessment_skills,
    *assessment_skill_branches,
    *achievements,
    *surveys,
    *video_tabs,
    *videos,
    *lesson_plan_events,
    *lesson_plan_milestones,
    *forums
  ]
end

#initialize_duplicate(duplicator, other) ⇒ Object


5
6
7
8
9
10
11
12
13
# File 'app/models/concerns/course/duplication_concern.rb', line 5

def initialize_duplicate(duplicator, other)
  self.start_at = duplicator.time_shift(start_at)
  self.end_at = duplicator.time_shift(end_at)
  self.title = duplicator.options[:new_title]
  self.creator = duplicator.options[:current_user]
  self.registration_key = nil
  .duplicate_from(other.) if other.logo_url
  material_folders << duplicator.duplicate(other.root_folder)
end

#objects_duplicable?Boolean

Override this method to prevent duplication of individual objects in the course.

Returns:

  • (Boolean)

42
43
44
# File 'app/models/concerns/course/duplication_concern.rb', line 42

def objects_duplicable?
  true
end