Class: Meibo::ClassroomSet

Inherits:
DataSet
  • Object
show all
Defined in:
lib/meibo/classroom_set.rb

Instance Attribute Summary

Attributes inherited from DataSet

#roster

Instance Method Summary collapse

Methods inherited from DataSet

#<<, #each, #empty?, #find, #initialize, #lineno, #where

Constructor Details

This class inherits a constructor from Meibo::DataSet

Instance Method Details

#check_semantically_consistentObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/meibo/classroom_set.rb', line 5

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

#homeroomObject



22
23
24
# File 'lib/meibo/classroom_set.rb', line 22

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

#scheduledObject



26
27
28
# File 'lib/meibo/classroom_set.rb', line 26

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