provostprovost / tyto

A classroom management app for creating, assigning and completing personalized classwork and homework.
4 stars 2 forks source link

Error when viewing dashboard for teacher with no classrooms/students #57

Closed provostprovost closed 10 years ago

provostprovost commented 10 years ago

undefined method `first' for nil:NilClass

@classrooms.each do |classroom|
  @students[classroom.id] = Tyto.db.get_students_in_classroom(classroom.id)
  @assignments[classroom.id] = Tyto.db.get_assignments_for_classroom(classroom.id, @students[classroom.id].first.id)
  @studenthomework[classroom.id] = {}
    @students[classroom.id].each do |x|
      @studenthomework[classroom.id][x.id] = Tyto.db.get_assignments_for_classroom(classroom.id, x.id)

Rails.root: /Users/brianprovost/code/mks/tyto/web

Application Trace | Framework Trace | Full Trace app/controllers/teachers_controller.rb:37:in block in show' app/controllers/teachers_controller.rb:35:ineach' app/controllers/teachers_controller.rb:35:in `show'

parthshahva commented 10 years ago

Fixed. Tested by signing in with need seed teacher username: john@teacher.com password: password1. Seems to be resolved.