Class: Meibo::EnrollmentSet
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
#administrator ⇒ Object
25
26
27
|
# File 'lib/meibo/enrollment_set.rb', line 25
def administrator
@cache[:administrator] ||= new(select(&:administrator?))
end
|
#check_semantically_consistent ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# 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)
unless school.school?
field = enrollment.school_sourced_id
field_info = field_info_from(enrollment, :school_sourced_id)
raise InvalidDataTypeError.new(field: field, field_info: field_info)
end
roster.users.find(enrollment.user_sourced_id)
next if !enrollment.primary || enrollment.teacher?
raise InvalidDataTypeError.new(field: enrollment.primary, field_info: field_info_from(enrollment, :primary))
end
end
|
#proctor ⇒ Object
29
30
31
|
# File 'lib/meibo/enrollment_set.rb', line 29
def proctor
@cache[:proctor] ||= new(select(&:proctor?))
end
|
#student ⇒ Object
33
34
35
|
# File 'lib/meibo/enrollment_set.rb', line 33
def student
@cache[:student] ||= new(select(&:student?))
end
|
#teacher ⇒ Object
37
38
39
|
# File 'lib/meibo/enrollment_set.rb', line 37
def teacher
@cache[:teacher] ||= new(select(&:teacher?))
end
|