diff --git a/app/controllers/lecture_controller.rb b/app/controllers/lecture_controller.rb index 45ad7cf..84a0b45 100644 --- a/app/controllers/lecture_controller.rb +++ b/app/controllers/lecture_controller.rb @@ -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 diff --git a/app/lib/toggl.rb b/app/lib/toggl.rb index 7f43956..6c0aabe 100644 --- a/app/lib/toggl.rb +++ b/app/lib/toggl.rb @@ -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, diff --git a/app/views/attendance_tracker/index.html.erb b/app/views/attendance_tracker/index.html.erb index 024d4a3..fe3c1bf 100644 --- a/app/views/attendance_tracker/index.html.erb +++ b/app/views/attendance_tracker/index.html.erb @@ -48,6 +48,12 @@