Allow for scraping toggl entries for specific courses only, change default to be active courses and add a new action to allow manual re-scraping in the case of errors.
Build and Publish Docker Container / build (push) Successful in 5m49s

This commit is contained in:
2024-02-07 10:08:01 +00:00
parent 52d11a41ab
commit 351694df12
5 changed files with 21 additions and 3 deletions
+7
View File
@@ -89,4 +89,11 @@ class Course < ApplicationRecord
raise "No default live video URL set" if self.default_live_video_url.nil?
lectures.where(live_video_url: nil).update_all(live_video_url: self.default_live_video_url)
end
# Sometimes our toggl entries get mismatched or otherwise out of sync. This method will delete all tracked time entries
# for this course and then re-import them from Toggl.
def redo_toggl_entries!
TrackedTimeEntry.where(lecture: lectures).destroy_all
ScrapeTogglJob.perform_later([self.id])
end
end