Module: ThinkFeelDoEngine::Reports::LessonModule
- Included in:
- LessonSlideView, LessonViewing
- Defined in:
- app/models/think_feel_do_engine/reports/lesson_module.rb
Overview
Shared Lesson Module behavior.
Constant Summary collapse
- URL_ROOT_RE =
%r{^[^\/]*\/\/[^\/]+}
Class Method Summary collapse
-
.included(klass) ⇒ Object
Disabling method length due to nested methods.
Class Method Details
.included(klass) ⇒ Object
Disabling method length due to nested methods. rubocop:disable Metrics/MethodLength,Lint/NestedMethodDefinition
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/think_feel_do_engine/reports/lesson_module.rb', line 9 def self.included(klass) class << klass # Returns a hash mapping lesson entry (first slide) path to Lesson # Module id. def lesson_entries_map lessons = ContentModules::LessonModule .includes(:content_providers).map do |m| first_provider_id = m.provider(1).try(:id) next unless first_provider_id path = navigator_location_path(module_id: m.id, provider_id: first_provider_id, content_position: 1) [path, m.id] end.compact Hash[lessons] end # Returns a hash mapping path to Lesson Module id. def lessons_map lessons = ContentModules::LessonModule.all.map do |m| path = navigator_location_path(module_id: m.id) [path, m.id] end Hash[lessons] end private def navigator_location_path() ThinkFeelDoEngine::Engine.routes.url_helpers .navigator_location_path() end end end |