Module: Course::CourseComponentsConcern

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

Instance Method Summary collapse

Methods included from CourseComponentQueryConcern

#enabled_components, #enabled_components_keys=, #set_component_enabled_boolean, #set_component_enabled_boolean!, #undisableable_components, #user_enabled_components

Instance Method Details

#available_componentsObject


6
7
8
9
10
11
# File 'app/models/concerns/course/course_components_concern.rb', line 6

def available_components
  @available_components ||= begin
    components = instance.enabled_components
    gamified? ? components : components.reject(&:gamified?)
  end
end

#disableable_componentsObject


13
14
15
# File 'app/models/concerns/course/course_components_concern.rb', line 13

def disableable_components
  @disableable_components ||= available_components.select(&:can_be_disabled_for_course?)
end