From 4c2272b1f0d71b646f0f0509747959993af881b3 Mon Sep 17 00:00:00 2001 From: Joshua Coles Date: Sun, 4 Feb 2024 15:37:56 +0000 Subject: [PATCH] Fix regression in lecture ordering, add time of lecture on hover, fix lecture duration using hours instead of minutes The update includes modifications in the lectures' order by start_time in course model. The lecture duration is now correctly calculated by minutes instead of hours. Additionally, in the lecture view, an online indicator is added for each lecture and popover is implemented to show the lecture start and end times.. --- app/models/course.rb | 2 +- app/models/lecture.rb | 2 +- .../_lecture_status_icons.html.erb | 2 +- app/views/lectures/_lecture.html.erb | 17 ++++++++++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index e9bd4b6..f65b361 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -1,5 +1,5 @@ class Course < ApplicationRecord - has_many :lectures, dependent: :destroy + has_many :lectures, -> { order("start_time") }, dependent: :destroy has_many :work_items, dependent: :destroy # A course has a standalone connection to its recordings. To be displayed they must be associated with a lecture but diff --git a/app/models/lecture.rb b/app/models/lecture.rb index 5dc4f9b..72ffa64 100644 --- a/app/models/lecture.rb +++ b/app/models/lecture.rb @@ -41,7 +41,7 @@ class Lecture < ApplicationRecord # NAIVE: Assumes that lectures are 50 minutes long, this is true currently but not assured. def end_time - start_time + 50.hour + start_time + 50.minutes end def is_live? diff --git a/app/views/attendance_tracker/_lecture_status_icons.html.erb b/app/views/attendance_tracker/_lecture_status_icons.html.erb index a3233c4..78f1cf5 100644 --- a/app/views/attendance_tracker/_lecture_status_icons.html.erb +++ b/app/views/attendance_tracker/_lecture_status_icons.html.erb @@ -44,4 +44,4 @@ <% end %> - \ No newline at end of file + diff --git a/app/views/lectures/_lecture.html.erb b/app/views/lectures/_lecture.html.erb index 9a303f0..dc743ac 100644 --- a/app/views/lectures/_lecture.html.erb +++ b/app/views/lectures/_lecture.html.erb @@ -4,9 +4,24 @@ }) %>"> <%= lecture.title %> + + <% if lecture.online %> + + <% end %> - + + <%= lecture.start_time.to_fs(:dmy) %> + +