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
|