Sha256: 657c7d4a25cac67db5f8f04ac03eff54fcdcb8f045497235f018508c0f581d0d

Contents?: true

Size: 1002 Bytes

Versions: 13

Compression:

Stored size: 1002 Bytes

Contents

# frozen_string_literal: true
module ContentModules
  # Methods for extending BitCore::ContentModule with scopes.
  module Scopes
    def didactic(group_id)
      didactic_module_ids = Task
                            .where(group_id: group_id,
                                   has_didactic_content: true)
                            .select(:id, :bit_core_content_module_id)
                            .map(&:bit_core_content_module_id)

      where(id: non_viz_module_ids & didactic_module_ids).select(:id)
    end

    def non_didactic(group_id)
      non_didactic_module_ids = Task.where(group_id: group_id,
                                           has_didactic_content: false)
                                    .select(:id, :bit_core_content_module_id)
                                    .map(&:bit_core_content_module_id)

      where(id: non_viz_module_ids & non_didactic_module_ids).select(:id)
    end

    def non_viz_module_ids
      where(is_viz: false).map(&:id)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/models/content_modules.rb
think_feel_do_engine-3.22.8 app/models/content_modules.rb
think_feel_do_engine-3.22.7 app/models/content_modules.rb
think_feel_do_engine-3.22.6 app/models/content_modules.rb
think_feel_do_engine-3.22.5 app/models/content_modules.rb
think_feel_do_engine-3.22.4 app/models/content_modules.rb
think_feel_do_engine-3.22.2 app/models/content_modules.rb
think_feel_do_engine-3.22.1 app/models/content_modules.rb
think_feel_do_engine-3.22.0 app/models/content_modules.rb
think_feel_do_engine-3.21.2 app/models/content_modules.rb
think_feel_do_engine-3.21.1 app/models/content_modules.rb
think_feel_do_engine-3.21.0 app/models/content_modules.rb
think_feel_do_engine-3.20.1 app/models/content_modules.rb