diff --git a/app/controllers/attendance_tracker_controller.rb b/app/controllers/attendance_tracker_controller.rb index 23ea906..9f4dab9 100644 --- a/app/controllers/attendance_tracker_controller.rb +++ b/app/controllers/attendance_tracker_controller.rb @@ -6,5 +6,7 @@ class AttendanceTrackerController < ApplicationController def today @courses = Course.all.sort_by(&:title) @date = Date.today + + @lectures = @courses.flat_map { |course| course.lectures.filter { |a| a.start_time.today? } }.sort_by { |l| l.start_time } end end diff --git a/app/views/attendance_tracker/today.html.erb b/app/views/attendance_tracker/today.html.erb index ecc54c7..fee392b 100644 --- a/app/views/attendance_tracker/today.html.erb +++ b/app/views/attendance_tracker/today.html.erb @@ -1,63 +1,132 @@
| Lecture | -Date | -Status | -Action | -- |
|---|---|---|---|---|
|
-
-
-
- Week <%= week_number %>
-
-
-
- <% total_for_week = lectures.sum { |lecture| lecture.total_overall_time }.seconds %>
- <%# TODO: Improve this figure, atm it is for lectures in week, not time spent in week (ie
- prepping for lecture next week will count in next week not current week) %>
- <% if total_for_week > 0 %>
- (Total <%= humanise_duration(lectures.sum { |lecture| lecture.total_overall_time }.seconds) %>
- )
- <% end %>
-
- |
- ||||
| Course | +Lecture | +Date | +Status | +Action | ++ |
|---|---|---|---|---|---|
| + <%= lecture.course.title %> + | ++ <%= lecture.title %> + | ++ <%= lecture.start_time.to_fs(:dmy) %> + | + +
+
+ <% prep_icon_class = if lecture.prepared?
+ 'text-green-700'
+ else
+ 'text-slate-300'
+ end %>
+
+
+ <% if lecture.attended? %>
+ <% if lecture.entirely_attended_in_person? %>
+
+ <% else %>
+
+ <% end %>
+ <% elsif lecture.is_live? %>
+
+ <% elsif lecture.start_time.past? %>
+
+ <% else %>
+
+ <% end %>
+
+ <% reviewed_icon_class = if lecture.start_time.future?
+ 'invisible'
+ elsif lecture.reviewed?
+ 'text-green-700'
+ else
+ 'text-slate-300'
+ end %>
+
+
+
+
+ <% unless lecture.tracked_time_entries.empty? %>
+
+
+ <% end %>
+
+
+ Preparation: <%= humanise_duration(lecture.total_preparation_time) %>
+
+
+ In lecture: <%= humanise_duration(lecture.total_attendance_time) %>
+
+
+ Review: <%= humanise_duration(lecture.total_review_time) %>
+
+ |
+
+
+ <% joinable_time = lecture.start_time - 5.minutes %>
+ <% if joinable_time.future? %>
+ <%= button_to "Prepare",
+ lecture_start_preparation_path(id: lecture.id),
+ class: 'action-button'
+ %>
+ <% elsif joinable_time.past? && !lecture.attended? %>
+ <% start_label = if lecture.is_live? then
+ "Join"
+ else
+ "Start"
+ end %>
+ <%= button_to start_label,
+ lectures_start_path(id: lecture.id),
+ class: 'action-button'
+ %>
+ <% else %>
+
+ <%= button_to "Review",
+ lecture_start_review_path(id: lecture.id),
+ class: 'action-button'
+ %>
+
+ <% end %>
+ |
+
+ + <% if lecture.recording %> + <%= link_to "Open recording", lecture.recording&.recording_url %> + <% end %> + | +
Find me in app/views/lecture/start.html.erb
-Find me in app/views/work_item/complete.html.erb
-Find me in app/views/work_item/start_time_entry.html.erb
-