Class: StudentProgress::StudentReport

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/student_progress/student_report.rb

Instance Method Summary collapse

Instance Method Details

#generate_current_topic_statusObject



9
10
11
12
13
14
15
16
17
# 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_nameObject



5
6
7
# File 'lib/student_progress/student_report.rb', line 5

def student_name
  self.student && self.student.full_name
end