Sha256: 1bf84308aa38f26b93eafa7f6f3c7a3b0b9b35781a716293c80e883c50accf37

Contents?: true

Size: 783 Bytes

Versions: 3

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module Meibo
  class ClassroomSet < DataSet
    def check_semantically_consistent
      super

      each do |classroom|
        school = roster.organizations.find(classroom.school_sourced_id)
        raise InvalidDataTypeError unless school.school?

        roster.courses.find(classroom.course_sourced_id)

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

        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

3 entries across 3 versions & 1 rubygems

Version Path
meibo-0.27.1 lib/meibo/classroom_set.rb
meibo-0.27.0 lib/meibo/classroom_set.rb
meibo-0.26.0 lib/meibo/classroom_set.rb