Sha256: 04db742ac759eb129e8a637d5af590e3dfe0ae4defe8c027574b5465e02a84c4

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true

module Meibo
  class ClassroomSet < DataSet
    def check_semantically_consistent
      super

      each do |classroom|
        roster.organizations.find(classroom.school_sourced_id)
        roster.courses.find(classroom.course_sourced_id)

        if classroom.term_sourced_ids.empty?
          raise DataNotFoundError, "termSourcedIdは1つ以上指定してください"
        end

        classroom.term_sourced_ids.each do |term_sourced_id|
          roster.academic_sessions.find(term_sourced_id)
        end
      end
    end

    def homeroom
      @cache[:homeroom] ||= new(select(&:homeroom?))
    end

    def scheduled
      @cache[:scheduled] ||= new(select(&:scheduled?))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo/classroom_set.rb
meibo-0.15.0 lib/meibo/classroom_set.rb
meibo-0.14.0 lib/meibo/classroom_set.rb
meibo-0.13.0 lib/meibo/classroom_set.rb