Add review and prep actions
Some checks reported warnings
Build and Publish Docker Container / build (push) Has been cancelled

This commit is contained in:
Joshua Coles 2023-10-04 15:14:19 +01:00
parent 9621f6fa24
commit 6c8d2544e0
4 changed files with 34 additions and 0 deletions

View File

@ -11,4 +11,22 @@ class LectureController < ApplicationController
redirect_to lecture.recording.recording_url, allow_other_host: true
end
end
def start_preparation
lecture = Lecture.find(params[:id])
Toggl::start_time_entry(
description: "#{lecture.title}: Prep",
project_id: lecture.course.toggl_project,
)
end
def start_review
lecture = Lecture.find(params[:id])
Toggl::start_time_entry(
description: "#{lecture.title}: Review",
project_id: lecture.course.toggl_project,
)
end
end

View File

@ -17,6 +17,7 @@ module Toggl
body: {
"created_with": "Attendance Tracker",
"description": description,
"start": Time.now.utc.iso8601,
"duration": -1,
"project_id": project_id,
}.to_json,

View File

@ -48,6 +48,12 @@
</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>
<% else %>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500 flex justify-center">
@ -71,6 +77,13 @@
class: 'action-button'
%>
<% else %>
<div class="flex justify-center">
<%= button_to "Review",
lecture_start_review_path(id: lecture.id),
class: 'action-button'
%>
</div>
<% if lecture.recording %>
<%= link_to "Open recording", lecture.recording&.recording_url %>
<% end %>

View File

@ -11,4 +11,6 @@ Rails.application.routes.draw do
root controller: :attendance_tracker, action: :index
post '/lectures/:id/start', to: 'lecture#start', as: :lectures_start
post '/lectures/:id/start_preparation', to: 'lecture#start_preparation', as: :lecture_start_preparation
post '/lectures/:id/start_review', to: 'lecture#start_review', as: :lecture_start_review
end