lib/meibo/enrollment_set.rb in meibo-0.25.3 vs lib/meibo/enrollment_set.rb in meibo-0.26.0
- old
+ new
@@ -5,11 +5,14 @@
def check_semantically_consistent
super
each do |enrollment|
roster.classes.find(enrollment.class_sourced_id)
- roster.organizations.find(enrollment.school_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
def administrator
@cache[:administrator] ||= new(select(&:administrator?))