Sha256: 2c7560862875a20c963785ccbcefea8e60c9be634b73870a813419907f9ebf53

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

module Meibo
  class ClassroomSet < DataSet
    def initialize(data, academic_session_set:, course_set:, organization_set:)
      super(data)
      @academic_session_set = academic_session_set
      @course_set = course_set
      @organization_set = organization_set
    end

    def check_semantically_consistent
      super

      each do |classroom|
        @organization_set.find_by_sourced_id(classroom.school_sourced_id)
        @course_set.find_by_sourced_id(classroom.course_sourced_id)

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

        classroom.term_sourced_ids.each do |term_sourced_id|
          @academic_session_set.find_by_sourced_id(term_sourced_id)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
meibo-0.1.0 lib/meibo/classroom_set.rb