class StudentProgress::StudentReport

Public Instance Methods

generate_current_topic_status() click to toggle source
# File lib/student_progress/student_report.rb, line 9
def generate_current_topic_status
  topic = StudentProgress::Lesson.topic_from_lesson_title(student.current_lab)
  ratio = (topic.lessons.map(&:id) & student.completed_lessons.map(&:lesson_id)).length/topic.lessons.count.to_f
  percent = (ratio*100).round(2)
  status = student.cohort.periscope_url ? "#{topic.title}: #{percent}% complete" : "to track this, add perisocpe url to cohort"
  self.current_topic_status = status
  self.save
  status
end
student_name() click to toggle source
# File lib/student_progress/student_report.rb, line 5
def student_name
  self.student && self.student.full_name
end