Sha256: 63662452cf31e865844a9f11cf1e205869e144048a7198c0cdcc132c50ef6a33

Contents?: true

Size: 684 Bytes

Versions: 30

Compression:

Stored size: 684 Bytes

Contents

class Chapter < ApplicationRecord
  include WithStats
  include WithNumber

  include TerminalNavigation
  include SiblingsNavigation

  include FriendlyName

  include TopicContainer

  belongs_to :book, optional: true

  has_many :exercises, through: :topic

  delegate :monolesson?, :monolesson, :first_lesson, to: :topic

  delegate :next_exercise, :stats_for, to: :monolesson, allow_nil: true

  def used_in?(organization)
    organization.book == self.book
  end

  def index_usage!(organization = Organization.current)
    organization.index_usage_of! topic, self
    lessons.each { |lesson| lesson.index_usage! organization }
  end

  def structural_parent
    book
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mumuki-domain-9.23.0 app/models/chapter.rb
mumuki-domain-9.22.1 app/models/chapter.rb
mumuki-domain-9.22.0 app/models/chapter.rb
mumuki-domain-9.21.0 app/models/chapter.rb
mumuki-domain-9.20.0 app/models/chapter.rb
mumuki-domain-9.19.0 app/models/chapter.rb
mumuki-domain-9.18.0 app/models/chapter.rb
mumuki-domain-9.17.0 app/models/chapter.rb
mumuki-domain-9.16.0 app/models/chapter.rb
mumuki-domain-9.15.0 app/models/chapter.rb
mumuki-domain-9.14.1 app/models/chapter.rb
mumuki-domain-9.14.0 app/models/chapter.rb
mumuki-domain-9.13.1 app/models/chapter.rb
mumuki-domain-9.13.0 app/models/chapter.rb
mumuki-domain-9.12.0 app/models/chapter.rb
mumuki-domain-9.11.0 app/models/chapter.rb
mumuki-domain-9.10.0 app/models/chapter.rb
mumuki-domain-9.9.0 app/models/chapter.rb
mumuki-domain-9.8.1 app/models/chapter.rb
mumuki-domain-9.8.0 app/models/chapter.rb