Track associated toggl entry id for uniqueness, show stats for time spent in different parts of the lecture flow.

This commit is contained in:
2023-10-06 22:00:01 +01:00
parent ef301f6592
commit 0cb03812cf
6 changed files with 135 additions and 47 deletions
+36 -29
View File
@@ -28,7 +28,7 @@
<% lectures.reject(&:cancelled).each do |lecture| %>
<tr class="<%= class_names({
'lecture-future': lecture.start_time.future?,
'bg-green-100': lecture.attendance.present?,
'bg-green-100': lecture.attended?,
}) %>">
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
<%= lecture.title %>
@@ -43,49 +43,56 @@
Cancelled
</div>
</td>
<% elsif lecture.start_time.future? %>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<div class="flex justify-center">
<%= button_to "Prepare",
lecture_start_preparation_path(id: lecture.id),
class: 'action-button'
%>
</div>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
</td>
<% else %>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500" data-controller="popover" data-action="mouseenter->popover#show mouseleave->popover#hide">
<div class="flex flex-row gap-2">
<% if lecture.attendance.nil? %>
<i class="fa fa-times text-red-700"></i>
<% elsif lecture.attendance.kind == 'concurrent' %>
<i class="fa fa-hourglass-start text-green-700"></i>
<% prep_icon_class = if lecture.prepared?
'text-green-700'
else
'text-slate-300'
end %>
<i class="fa fa-hourglass-start <%= prep_icon_class %>"></i>
<% if lecture.attended? %>
<i class="fa fa-chalkboard-user text-green-700"></i>
<i class="fa fa-hourglass-end text-green-700"></i>
<% elsif lecture.attendance.kind == 'catchup' %>
<i class="fa fa-video text-green-700"></i>
<% elsif lecture.start_time.past? %>
<i class="fa fa-times text-red-700"></i>
<% else %>
<% lecture.attendance.kind %>
<div class="flex-grow"></div>
<% end %>
<% reviewed_icon_class = if lecture.start_time.future?
'invisible'
elsif lecture.reviewed?
'text-green-700'
else
'text-slate-300'
end %>
<i class="fa fa-hourglass-end <%= reviewed_icon_class %>"></i>
</div>
<template data-popover-target="content">
<% if lecture.attendance.present? %>
<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">
In lecture: <%= lecture.attendance.duration.in_minutes.round %> minutes
<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">
<div>
Preparation: <%= lecture.total_preparation_time.in_minutes.round %> minutes
</div>
<% end %>
<div>
In lecture: <%= lecture.total_attendance_time.in_minutes.round %> minutes
</div>
<div>
Review: <%= lecture.total_review_time.in_minutes.round %> minutes
</div>
</div>
</template>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<% if lecture.attendance.nil? %>
<% if lecture.start_time.future? %>
<%= button_to "Prepare",
lecture_start_preparation_path(id: lecture.id),
class: 'action-button'
%>
<% elsif lecture.start_time.past? && !lecture.attended? %>
<%= button_to "Start",
lectures_start_path(id: lecture.id),
class: 'action-button'