class StudentProgress::Cohort

Public Instance Methods

add_students(usernames) click to toggle source
# File lib/student_progress/cohort.rb, line 4
def add_students(usernames)
  usernames.each do |username|
    student = StudentProgress::Student.find_or_create(github_username: username.downcase)
    self.add_student(student)
    student.save
  end
  self.save
end
delete_and_unassign_students() click to toggle source
# File lib/student_progress/cohort.rb, line 28
def delete_and_unassign_students
  students.each do |student|
    student.cohort_id = nil
    student.save
  end
  self.delete
end
remove_students(usernames) click to toggle source
# File lib/student_progress/cohort.rb, line 13
def remove_students(usernames)
  removed = 0
  usernames.each do |username|
    student = self.students_dataset.first(github_username: username.downcase)
    if student
      self.remove_student(student)
      removed += 1
    else
      puts "Student with github username: #{username} not found."
    end
  end
  self.save
  removed
end
run_progress_report() click to toggle source
# File lib/student_progress/cohort.rb, line 36
def run_progress_report
  StudentProgress::Scraper.scrape_progress(self)
end