Skip to content

Commit

Permalink
Merge pull request #1964 from MindLeaps/feature/ML-1393-count-of-stud…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
tomca32 committed Jul 18, 2024
2 parents f96c5d3 + d8a5f6f commit 738491a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/components/common_components/student_statistics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def initialize(student_lesson_summaries)
@total_students = @student_lesson_summaries.count
@total_attending_students = @student_lesson_summaries.where.not(average_mark: nil).count
@sum_of_average_marks = @student_lesson_summaries.where.not(average_mark: nil).sum(:average_mark)
@average_mark_across_students = @total_attending_students ? (@sum_of_average_marks / @total_attending_students.to_f).round(2) : 0
@average_mark_across_students = @total_attending_students.positive? ? (@sum_of_average_marks / @total_attending_students.to_f).round(2) : 0
@absent_students = @total_students - @total_attending_students
end

Expand Down

0 comments on commit 738491a

Please sign in to comment.