Fix regression in lecture ordering, add time of lecture on hover, fix lecture duration using hours instead of minutes
All checks were successful
Build and Publish Docker Container / build (push) Successful in 5m44s

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..
This commit is contained in:
Joshua Coles 2024-02-04 15:37:56 +00:00
parent f81005408e
commit 4c2272b1f0
4 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -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?

View File

@ -44,4 +44,4 @@
</div>
</div>
<% end %>
</template>
</template>

View File

@ -4,9 +4,24 @@
}) %>">
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
<%= lecture.title %>
<% if lecture.online %>
<i class="fa fa-solid fa-globe text-gray-500"></i>
<% end %>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<td
class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"
data-controller="popover"
data-action="mouseenter->popover#show mouseleave->popover#hide"
>
<%= lecture.start_time.to_fs(:dmy) %>
<template data-popover-target="content">
<div class="absolute p-1 w-max whitespace-normal break-words rounded-lg border border-blue-gray-50 bg-white text-blue-gray-500 shadow-lg shadow-blue-gray-500/10 focus:outline-none" data-popover-target="card">
<%= lecture.start_time.to_fs(:time) %> &dash; <%= lecture.end_time.to_fs(:time) %>
</div>
</template>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500" data-controller="popover" data-action="mouseenter->popover#show mouseleave->popover#hide">