Add total lecture time and improve time representation

In the attendance tracker view, the total times for preparation, in lecture, and review have been humanized for better readability. Also, total time spent on lectures for each week has been included for a quicker overview. A helper method 'humanise_duration' has been added in application helper to convert time into a more readable format. Changes have been done in 'lecture' model for calculation of total time.
This commit is contained in:
2023-10-06 22:38:48 +01:00
parent e6dcd8e6ec
commit a0918ce011
3 changed files with 46 additions and 11 deletions
+4
View File
@@ -25,6 +25,10 @@ class Lecture < ApplicationRecord
tracked_time_entries.preparation.sum(&:duration).seconds
end
def total_overall_time
tracked_time_entries.sum(&:duration).seconds
end
def total_attendance_time
tracked_time_entries.where(kind: [:concurrent, :catchup]).sum(&:duration).seconds
end