Class: Meibo::EnrollmentSet

Inherits:
DataSet
  • Object
show all
Defined in:
lib/meibo/enrollment_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

#administratorObject



18
19
20
# File 'lib/meibo/enrollment_set.rb', line 18

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

#check_semantically_consistentObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/meibo/enrollment_set.rb', line 5

def check_semantically_consistent
  super

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

    roster.users.find(enrollment.user_sourced_id)
    raise InvalidDataTypeError if enrollment.primary && !enrollment.teacher?
  end
end

#proctorObject



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

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

#studentObject



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

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

#teacherObject



30
31
32
# File 'lib/meibo/enrollment_set.rb', line 30

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