Implement catch-up tracking feature
Build and Publish Docker Container / build (push) Successful in 5m29s

This update enhances tracking functionality. It adds the ability to track time spent 'catching up' on lectures, with distinctions made within the controllers and views to handle these new 'catch-up' entries. Also implemented a flexible match for lecture titles to include various forms such as 'Lecture 1', 'Lecture 1: Prep' and the 'Catch-up'.
This commit is contained in:
2024-02-07 10:46:47 +00:00
parent f850526a59
commit 4b3204d2f4
4 changed files with 38 additions and 15 deletions
+9
View File
@@ -80,6 +80,7 @@ class ScrapeTogglJob < ApplicationJob
preparation_regex = /^(.+): ?(?:Prep|Preparation)?$/
review_regex = /^(.+): ?(?:Review|Recap)/
catchup_regex = /^(.+): ?(?:Catch-up|Catch up|Catch Up)/
if (lecture_title_match = entry_title.match(preparation_regex)) and (lecture = lectures.find_by(title: lecture_title_match[1]))
lecture.tracked_time_entries.create!(
@@ -96,6 +97,14 @@ class ScrapeTogglJob < ApplicationJob
associated_toggl_entry_id: entry['time_entries'][0]['id'],
)
# broadcast_update_to lecture, :lectures
elsif (lecture_title_match = entry_title.match(catchup_regex)) and (lecture = lectures.find_by(title: lecture_title_match[1]))
lecture.tracked_time_entries.create!(
kind: :catchup,
toggl_data: entry,
associated_toggl_entry_id: entry['time_entries'][0]['id'],
)
# broadcast_update_to lecture, :lectures
end
end