Skip to content

Instantly share code, notes, and snippets.

@knowuh
Created May 11, 2011 22:03
Show Gist options
  • Save knowuh/967487 to your computer and use it in GitHub Desktop.
Save knowuh/967487 to your computer and use it in GitHub Desktop.
badstudents = Portal::Student.all.select { |s| s.user.nil? }
# => [] # no students were "bad"
badteachers = Portal::Teacher.all.select { |t| t.user.nil? }
# => teacher id 1447 # one bad teacher was found
badclazzes = Portal::Clazz.all.select { |c| c.teacher.nil? }; badclazzes.size
# => 4631 FOUR THOUSAND ++ CLASSES WITH NO TEACHER!!!!
# the really bad classes will be the ones where there are students but no teacher:
reallybadclazzes = badclazzes.select { |c| c.students.size > 0 }; reallybadclazzes.size
# => 23
# The clazzes that are bad:
reallybadclazzes.sort{|a,b| a.name.downcase <=> b.name.downcase }.each { |c| puts "#{c.name} (#{c.id})" }; nil
8 Orange Science (12970)
Biological Role of Sounds (12912)
Biological Role of Sounds 2 (12995)
class 1 (12951)
Class 1 (12960)
Earthquakes (12944)
Energy Conservation URI (13008)
ESS4-astronomy (12914)
ESS4-astronomy URI (12945)
Period 3 (13012)
Period 4 (13013)
Properties of Matter A (12981)
Properties of Matter B (12992)
PS3 Energy Conservation RIC (12922)
RITES (12938)
RITES: Sleuthing Through the Rock Cycle (12942)
Rock Cycle: RIC (12971)
Rock Cycle: URI (12998)
Sample Class (13071)
Sarah's test class (12909)
Test Class (12906)
Tides (13039)
Tides-GSO (12915)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment