Compare commits
13 Commits
4c2272b1f0
...
b4b6976cb3
| Author | SHA1 | Date | |
|---|---|---|---|
| b4b6976cb3 | |||
| e5efd3de75 | |||
| eceaf91539 | |||
| bb7f0a824d | |||
| c1c7342497 | |||
| ab43d0f7a0 | |||
| 39554fb176 | |||
| af3f2ca39d | |||
| 2926cfdbea | |||
| 6e85c4103a | |||
| bee3984a35 | |||
| 28c3fd27be | |||
| 5f6bd01882 |
6
Procfile
6
Procfile
@ -1,5 +1,5 @@
|
|||||||
toggl-gateway: RUST_LOG=debug /Users/joshuacoles/Developer/checkouts/joshuacoles/beachhead/target/debug/toggl-portal --addr 0.0.0.0:3005 -t 237918c4e008f5aeefe886c9112ab560 -w 2837131
|
#toggl-gateway: RUST_LOG=debug /Users/joshuacoles/Developer/checkouts/joshuacoles/beachhead/target/debug/toggl-portal --addr 0.0.0.0:3005 -t 237918c4e008f5aeefe886c9112ab560 -w 2837131
|
||||||
lectures: RUST_LOG=debug /Users/joshuacoles/Developer/checkouts/joshuacoles/beachhead/target/release/lectures --addr 0.0.0.0:3010 --token 162EF2CEB64AE42EBD3DE8B15328F24A3E39E16D14719ACC86BB53EC1BF65574E29389B999105291F0761EDB2F77FC4EB23CE98A453B41644FAA40D34AD6572F830FB1CA2F51E9D96F63485E04084CC7EAB048EDE0C229F86D2E2E37951612FA90E3744D6CE8EE61DA7451F3DB7757E8C56EA4A327504B7FCF762ED522E2300B2F013813EA735EFDD18221BB7B31A404C7F4F1C7DDC62FDE70C9D7F06E52DE0DFAA74C3AAAAB20B93A004ED4F83388E87DA5A788772B459759D3FBE0E365FCA121A850CF0F0092046091B8AA52F045C086348AA6060DDAD22585FA11DF5FF435C12DB04E1649CEA0C984205855C4BB92
|
#lectures: RUST_LOG=debug /Users/joshuacoles/Developer/checkouts/joshuacoles/beachhead/target/release/lectures --addr 0.0.0.0:3010 --token 162EF2CEB64AE42EBD3DE8B15328F24A3E39E16D14719ACC86BB53EC1BF65574E29389B999105291F0761EDB2F77FC4EB23CE98A453B41644FAA40D34AD6572F830FB1CA2F51E9D96F63485E04084CC7EAB048EDE0C229F86D2E2E37951612FA90E3744D6CE8EE61DA7451F3DB7757E8C56EA4A327504B7FCF762ED522E2300B2F013813EA735EFDD18221BB7B31A404C7F4F1C7DDC62FDE70C9D7F06E52DE0DFAA74C3AAAAB20B93A004ED4F83388E87DA5A788772B459759D3FBE0E365FCA121A850CF0F0092046091B8AA52F045C086348AA6060DDAD22585FA11DF5FF435C12DB04E1649CEA0C984205855C4BB92
|
||||||
css: bin/rails tailwindcss:watch
|
css: bin/rails tailwindcss:watch
|
||||||
redis: /opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
|
redis: /opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
|
||||||
sidekiq: bundle exec sidekiq -C config/sidekiq.yml
|
#sidekiq: bundle exec sidekiq -C config/sidekiq.yml
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
class AttendanceTrackerController < ApplicationController
|
class AttendanceTrackerController < ApplicationController
|
||||||
def index
|
before_action :refresh_toggl
|
||||||
@courses = Course.active.sort_by(&:title)
|
|
||||||
@current_lecture = get_current_lecture
|
|
||||||
end
|
|
||||||
|
|
||||||
def overview
|
def overview
|
||||||
@courses = Course.active.sort_by(&:title)
|
@courses = Course.active.sort_by(&:title)
|
||||||
@ -13,7 +10,7 @@ class AttendanceTrackerController < ApplicationController
|
|||||||
@courses = Course.active.sort_by(&:title)
|
@courses = Course.active.sort_by(&:title)
|
||||||
@date = Date.today
|
@date = Date.today
|
||||||
@current_lecture = get_current_lecture
|
@current_lecture = get_current_lecture
|
||||||
@lectures = @courses.flat_map { |course| course.lectures.filter { |a| a.start_time.today? } }.sort_by { |l| l.start_time }
|
@lectures = @courses.flat_map { |course| course.lectures.filter { |a| a.start_time.to_date == @date } }.sort_by { |l| l.start_time }
|
||||||
end
|
end
|
||||||
|
|
||||||
def course_focus
|
def course_focus
|
||||||
@ -41,4 +38,8 @@ class AttendanceTrackerController < ApplicationController
|
|||||||
|
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def refresh_toggl
|
||||||
|
ScrapeTogglJob.perform_later
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,7 +3,7 @@ class LectureCheckinJob < ApplicationJob
|
|||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
lecture = Lecture.find_by(start_time: Time.now - 5.minutes..Time.now + 5.minutes)
|
lecture = Lecture.find_by(start_time: Time.now - 5.minutes..Time.now + 5.minutes)
|
||||||
return if lecture.empty?
|
return unless lecture.present?
|
||||||
|
|
||||||
puts(HTTParty.post(
|
puts(HTTParty.post(
|
||||||
"https://api.pushcut.io/2Kdtb5V7SoDXQOPxCJetk/notifications/Checkin",
|
"https://api.pushcut.io/2Kdtb5V7SoDXQOPxCJetk/notifications/Checkin",
|
||||||
|
|||||||
@ -2,6 +2,8 @@ class ScrapePanoptoJob < ApplicationJob
|
|||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
|
return if true # TODO: Remove this line when we're ready to start scraping Panopto
|
||||||
|
|
||||||
courses = Course.all
|
courses = Course.all
|
||||||
|
|
||||||
courses.each do |course|
|
courses.each do |course|
|
||||||
|
|||||||
@ -20,8 +20,8 @@ class ScrapeTogglJob < ApplicationJob
|
|||||||
toggl_project_id,
|
toggl_project_id,
|
||||||
|
|
||||||
# TODO: Work out better limits
|
# TODO: Work out better limits
|
||||||
start_time: Time.new('2023-01-01'),
|
start_time: course.semester_start_date - 2.months,
|
||||||
end_time: Time.new('2024-01-01')
|
end_time: course.semester_start_date + 15.weeks + 2.months,
|
||||||
)
|
)
|
||||||
|
|
||||||
puts("Entries data for #{course.title}: #{entries_data}")
|
puts("Entries data for #{course.title}: #{entries_data}")
|
||||||
@ -87,12 +87,16 @@ class ScrapeTogglJob < ApplicationJob
|
|||||||
toggl_data: entry,
|
toggl_data: entry,
|
||||||
associated_toggl_entry_id: entry['time_entries'][0]['id'],
|
associated_toggl_entry_id: entry['time_entries'][0]['id'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
lecture.broadcast_update
|
||||||
elsif (lecture_title_match = entry_title.match(review_regex)) and (lecture = lectures.find_by(title: lecture_title_match[1]))
|
elsif (lecture_title_match = entry_title.match(review_regex)) and (lecture = lectures.find_by(title: lecture_title_match[1]))
|
||||||
lecture.tracked_time_entries.create!(
|
lecture.tracked_time_entries.create!(
|
||||||
kind: :review,
|
kind: :review,
|
||||||
toggl_data: entry,
|
toggl_data: entry,
|
||||||
associated_toggl_entry_id: entry['time_entries'][0]['id'],
|
associated_toggl_entry_id: entry['time_entries'][0]['id'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
lecture.broadcast_update
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,25 +1,38 @@
|
|||||||
module Toggl
|
module Toggl
|
||||||
def self.current_time_entry
|
def self.current_time_entry
|
||||||
JSON.parse(HTTParty.get(
|
response = HTTParty.get(
|
||||||
"#{TOGGL_PORTAL_URL}/current",
|
"#{TOGGL_PORTAL_URL}/current",
|
||||||
headers: { 'Accept' => 'application/json' }
|
headers: { 'Accept' => 'application/json' }
|
||||||
).body)
|
)
|
||||||
|
|
||||||
|
if response.success?
|
||||||
|
return JSON.parse(response.body)
|
||||||
|
else
|
||||||
|
raise "Error fetching current time entry: #{response.body}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.entries_for_project(toggl_project_id, start_time:, end_time:)
|
def self.entries_for_project(toggl_project_id, start_time:, end_time:)
|
||||||
JSON.parse(HTTParty.post(
|
response = HTTParty.post(
|
||||||
"#{TOGGL_PORTAL_URL}/report",
|
"#{TOGGL_PORTAL_URL}/report",
|
||||||
body: {
|
body: {
|
||||||
"start_date": start_time.to_date.to_fs(),
|
# TODO: Replace these, rails keeps complaining about deprecations
|
||||||
"end_date": end_time.to_date.to_fs(),
|
"start_date": start_time.to_date.to_fs(:db),
|
||||||
|
"end_date": end_time.to_date.to_fs(:db),
|
||||||
"project_ids": [toggl_project_id]
|
"project_ids": [toggl_project_id]
|
||||||
}.to_json,
|
}.to_json,
|
||||||
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
||||||
).body)
|
)
|
||||||
|
|
||||||
|
if response.success?
|
||||||
|
return JSON.parse(response.body)
|
||||||
|
else
|
||||||
|
raise "Error fetching Toggl entries for project: #{response.body}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.start_time_entry(description:, project_id:)
|
def self.start_time_entry(description:, project_id:)
|
||||||
HTTParty.post(
|
response = HTTParty.post(
|
||||||
"#{TOGGL_PORTAL_URL}/start_time_entry",
|
"#{TOGGL_PORTAL_URL}/start_time_entry",
|
||||||
body: {
|
body: {
|
||||||
"created_with": "Attendance Tracker",
|
"created_with": "Attendance Tracker",
|
||||||
@ -30,5 +43,7 @@ module Toggl
|
|||||||
}.to_json,
|
}.to_json,
|
||||||
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
raise "Error starting Toggl time entry: #{response.body}" unless response.success?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,42 +1,26 @@
|
|||||||
<div class="divide-y divide-gray-300 w-full">
|
<div class="divide-y divide-gray-300 w-full">
|
||||||
<div class="py-3.5 justify-between bg-gray-50 text-left text-sm font-semibold text-gray-900 px-6 grid grid-cols-4">
|
<div class="py-3.5 justify-between gap-2 bg-gray-50 text-left text-sm font-semibold text-gray-900 px-6 grid grid-cols-5">
|
||||||
<div>Lecture</div>
|
<div>Lecture</div>
|
||||||
|
<div>Date</div>
|
||||||
<div>Status</div>
|
<div>Status</div>
|
||||||
<div>Action</div>
|
<div>Action</div>
|
||||||
<div>Recording</div>
|
<div>Recording</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% course.lectures.sort_by(&:start_time).group_by(&:week_number).each do |(week_number, lectures)| %>
|
<% course.lectures.sort_by(&:start_time).group_by(&:week_number).each do |(week_number, lectures)| %>
|
||||||
<div class="py-3.5 bg-gray-50 text-left text-sm font-semibold text-gray-900 px-6 grid grid-cols-4">
|
<div class="py-2 bg-gray-50 text-left text-sm font-semibold text-gray-900 px-6 flex flex-row justify-between">
|
||||||
Week <%= week_number %>
|
Week <%= week_number %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<% 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 %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% lectures.each do |lecture| %>
|
<%= render lectures %>
|
||||||
<% status_classes = class_names({
|
|
||||||
'lecture-future': lecture.start_time.future?,
|
|
||||||
'bg-purple-100': lecture == @current_lecture,
|
|
||||||
'bg-green-100': lecture.attended?,
|
|
||||||
}) %>
|
|
||||||
|
|
||||||
<div class="<%= status_classes %> px-6 py-4 flex justify-between items-center grid grid-cols-4">
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
|
||||||
<%= lecture.title %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900" data-controller="popover" data-action="mouseenter->popover#show mouseleave->popover#hide">
|
|
||||||
<%= render partial: 'lecture_status_icons', locals: { lecture: } %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
|
||||||
<%= render partial: 'lecture_action', locals: { lecture: } %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
|
||||||
<% if lecture.recording %>
|
|
||||||
<%= link_to "Open recording", lecture.recording&.recording_url %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -8,14 +8,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-4">
|
<div class="mx-10 mt-4 shadow ring-1 ring-black ring-opacity-5 rounded-lg">
|
||||||
<div class="mt-8 flow-root">
|
<%= render partial: 'course_table', locals: { course: @course, current_lecture: @current_lecture } %>
|
||||||
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
||||||
<div class="inline-block py-2 align-middle px-6 lg:px-8 w-full">
|
|
||||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg">
|
|
||||||
<%= render partial: 'course_table', locals: { course: @course, current_lecture: @current_lecture } %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,63 +0,0 @@
|
|||||||
<h1 class="text-3xl font-medium">Attendance Tracker</h1>
|
|
||||||
|
|
||||||
<div class="px-4 sm:px-6 lg:px-8 flex flex-col lg:flex-row gap-4">
|
|
||||||
<% @courses.each do |course| %>
|
|
||||||
<div class="mt-8 flow-root">
|
|
||||||
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
||||||
<div class="inline-block py-2 align-middle px-6 lg:px-8">
|
|
||||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg">
|
|
||||||
<div class="flex flex-row justify-between items-center px-4 p-2">
|
|
||||||
<h2 class="text-2xl">
|
|
||||||
<%= course.title %>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<% if course.homepage.present? %>
|
|
||||||
<a class="align-middle" href="<%= course.homepage %>">
|
|
||||||
<i class="fa fa-link text-blue-600"></i>
|
|
||||||
</a>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class="border-t-2 divide-y divide-gray-300 w-full">
|
|
||||||
<thead class="bg-gray-50">
|
|
||||||
<tr>
|
|
||||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Lecture</th>
|
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Date</th>
|
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Status</th>
|
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Action</th>
|
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody class="divide-y divide-gray-200 bg-white">
|
|
||||||
<% course.lectures.group_by { |lecture| lecture.week_number }.each do |(week_number, lectures)| %>
|
|
||||||
<tr class="border-t border-gray-200">
|
|
||||||
<th colspan="5" scope="colgroup" class="bg-gray-50 py-2 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
|
||||||
<div class="flex flex-row justify-between">
|
|
||||||
<div class="">
|
|
||||||
Week <%= week_number %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<% 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 %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<%= render lectures %>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
@ -2,13 +2,21 @@
|
|||||||
<h1 class="text-3xl font-medium">Overview</h1>
|
<h1 class="text-3xl font-medium">Overview</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-2">
|
<div class="flex flex-row flex-wrap gap-4 justify-around items-start">
|
||||||
<% @courses.each do |course| %>
|
<% @courses.each do |course| %>
|
||||||
<div class="mt-4 py-2">
|
<div class="min-w-[350px] sm:min-w-[500px] flex-grow max-w-lg mt-4 shadow ring-1 ring-black ring-opacity-5 rounded-lg">
|
||||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg">
|
<div class="flex flex-row gap-2 items-center px-4 p-2 justify-between">
|
||||||
<div class="divide-y divide-gray-300 w-full">
|
<h1 class="text-xl font-medium"><%= course.title %></h1>
|
||||||
<%= render partial: 'course_table', locals: { course: course } %>
|
|
||||||
</div>
|
<% if course.homepage.present? %>
|
||||||
|
<a class="align-middle" href="<%= course.homepage %>">
|
||||||
|
<i class="fa fa-link text-blue-600"></i>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="border-t-2 divide-y divide-gray-300 w-full">
|
||||||
|
<%= render partial: 'course_table', locals: { course: course, current_lecture: @current_lecture } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -10,31 +10,7 @@
|
|||||||
<div>Action</div>
|
<div>Action</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% @lectures.each do |lecture| %>
|
<%= render @lectures, { today_view: true } %>
|
||||||
<% status_classes = class_names({
|
|
||||||
'lecture-future': lecture.start_time.future?,
|
|
||||||
'bg-purple-100': lecture == @current_lecture,
|
|
||||||
'bg-green-100': lecture.attended?,
|
|
||||||
}) %>
|
|
||||||
|
|
||||||
<div class="px-6 py-4 flex justify-between items-center grid today-table-grid gap-2 <%= status_classes %>">
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
|
||||||
<%= lecture.course.title %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
|
||||||
<%= lecture.title %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900" data-controller="popover" data-action="mouseenter->popover#show mouseleave->popover#hide">
|
|
||||||
<%= render partial: 'lecture_status_icons', locals: { lecture: } %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
|
||||||
<%= render partial: 'lecture_action', locals: { lecture: } %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,63 +1,50 @@
|
|||||||
<tr class="<%= class_names({
|
<% status_classes = class_names({
|
||||||
'lecture-future': lecture.start_time.future?,
|
'lecture-future': lecture.start_time.future?,
|
||||||
'bg-green-100': lecture.attended?,
|
'bg-purple-100': lecture == @current_lecture,
|
||||||
}) %>">
|
'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">
|
}) %>
|
||||||
|
|
||||||
|
<%= turbo_stream_from lecture %>
|
||||||
|
|
||||||
|
<div id="<%= dom_id(lecture) %>" class="<%= status_classes %> px-6 py-4 flex justify-between items-center grid grid-cols-5 gap-2">
|
||||||
|
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
||||||
<%= lecture.title %>
|
<%= lecture.title %>
|
||||||
|
|
||||||
<% if lecture.online %>
|
<% if lecture.online %>
|
||||||
<i class="fa fa-solid fa-globe text-gray-500"></i>
|
<i class="fa fa-solid fa-globe text-gray-500"></i>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</div>
|
||||||
|
|
||||||
<td
|
<div
|
||||||
class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"
|
class="whitespace-nowrap text-sm text-gray-500"
|
||||||
data-controller="popover"
|
data-controller="popover"
|
||||||
data-action="mouseenter->popover#show mouseleave->popover#hide"
|
data-action="mouseenter->popover#show mouseleave->popover#hide"
|
||||||
>
|
>
|
||||||
<%= lecture.start_time.to_fs(:dmy) %>
|
<% if local_assigns[:today_view] %>
|
||||||
|
<%= lecture.start_time.to_fs(:time) %> ‐ <%= lecture.end_time.to_fs(:time) %>
|
||||||
<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) %> ‐ <%= 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">
|
|
||||||
<%= render partial: 'lecture_status_icons', locals: { lecture: } %>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
|
||||||
<% 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 %>
|
<% else %>
|
||||||
<div class="flex justify-center">
|
<%= lecture.start_time.to_fs(:dmy) %>
|
||||||
<%= button_to "Review",
|
|
||||||
lecture_start_review_path(id: lecture.id),
|
|
||||||
class: 'action-button'
|
|
||||||
%>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
<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) %> ‐ <%= lecture.end_time.to_fs(:time) %>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="whitespace-nowrap text-sm font-medium text-gray-900" data-controller="popover" data-action="mouseenter->popover#show mouseleave->popover#hide">
|
||||||
|
<%= render partial: 'lectures/lecture_status_icons', locals: { lecture: } %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
||||||
|
<%= render partial: 'lectures/lecture_action', locals: { lecture: } %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
||||||
<% if lecture.recording %>
|
<% if lecture.recording %>
|
||||||
<%= link_to "Open recording", lecture.recording&.recording_url %>
|
<%= link_to "Open recording", lecture.recording&.recording_url %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
# TODO: Is there a better way to do this?
|
# TODO: Is there a better way to do this?
|
||||||
TOGGL_PORTAL_URL = ENV['TOGGL_PORTAL_URL'] || 'http://cosmos:7001'
|
TOGGL_PORTAL_URL = ENV['TOGGL_PORTAL_URL'] || 'http://localhost:3005' ||'http://cosmos:7001'
|
||||||
PANOPTO_PORTAL_URL = ENV['PANOPTO_PORTAL_URL'] || 'https://lectures.joshuacoles.me'
|
PANOPTO_PORTAL_URL = ENV['PANOPTO_PORTAL_URL'] || 'https://lectures.joshuacoles.me'
|
||||||
|
|||||||
@ -12,7 +12,7 @@ Rails.application.routes.draw do
|
|||||||
get '/courses/:id/fill_in_default_live_video_url', to: 'courses#fill_in_default_live_video_url', as: :course_fill_in_default_live_video_url
|
get '/courses/:id/fill_in_default_live_video_url', to: 'courses#fill_in_default_live_video_url', as: :course_fill_in_default_live_video_url
|
||||||
end
|
end
|
||||||
|
|
||||||
root controller: :attendance_tracker, action: :index
|
root controller: :attendance_tracker, action: :overview
|
||||||
get '/today', controller: :attendance_tracker, action: :today
|
get '/today', controller: :attendance_tracker, action: :today
|
||||||
get '/overview', controller: :attendance_tracker, action: :overview
|
get '/overview', controller: :attendance_tracker, action: :overview
|
||||||
get '/courses/:id', controller: :attendance_tracker, action: :course_focus
|
get '/courses/:id', controller: :attendance_tracker, action: :course_focus
|
||||||
|
|||||||
@ -62,7 +62,8 @@ Course.create!(
|
|||||||
toggl_project: 199383698,
|
toggl_project: 199383698,
|
||||||
unit_code: 'MA40256',
|
unit_code: 'MA40256',
|
||||||
semester_start_date: START_OF_YEAR_5_SEMESTER_2.to_date,
|
semester_start_date: START_OF_YEAR_5_SEMESTER_2.to_date,
|
||||||
homepage: 'https://moodle.bath.ac.uk/course/view.php?id=57713'
|
homepage: 'https://moodle.bath.ac.uk/course/view.php?id=57713',
|
||||||
|
default_live_video_url: 'https://bath-ac-uk.zoom.us/j/9996300https://bath-ac-uk.zoom.us/j/99963008096?pwd=N3hVbWRGdXFXSVJUcHJmZzBSRm1tdz098096?pwd=N3hVbWRGdXFXSVJUcHJmZzBSRm1tdz09'
|
||||||
)
|
)
|
||||||
|
|
||||||
Course.create!(
|
Course.create!(
|
||||||
@ -71,5 +72,6 @@ Course.create!(
|
|||||||
toggl_project: 198859760,
|
toggl_project: 198859760,
|
||||||
unit_code: 'MA40049',
|
unit_code: 'MA40049',
|
||||||
semester_start_date: START_OF_YEAR_5_SEMESTER_2.to_date,
|
semester_start_date: START_OF_YEAR_5_SEMESTER_2.to_date,
|
||||||
homepage: 'https://moodle.bath.ac.uk/course/view.php?id=1814'
|
homepage: 'https://moodle.bath.ac.uk/course/view.php?id=1814',
|
||||||
|
default_live_video_url: 'https://bath-ac-uk.zoom.us/j/99630316511?pwd=d00xQTByeGtNaHZzNkR6YnpKM0RxZz09'
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
module Toggl
|
module Toggl
|
||||||
def self.entries_for_project: -> Array[untyped]
|
def self.entries_for_project: -> Array[untyped]
|
||||||
|
|
||||||
|
def self.current_time_entry: -> untyped
|
||||||
|
|
||||||
|
def self.start_time_entry: (description: string, project_id: int) -> void
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user