Continue adding problem sheets

This commit is contained in:
2023-10-08 15:46:19 +01:00
parent 7344ac3d67
commit f9f4762450
8 changed files with 82 additions and 7 deletions
+7 -1
View File
@@ -12,7 +12,7 @@ class ScrapeTogglJob < ApplicationJob
# @param [Course] course
def scrape_course(course)
toggl_project_id = course.toggl_project
lectures = course.lectures.order(:start_time).includes(:attendance)
lectures = course.lectures.order(:start_time).includes(:tracked_time_entries)
return if lectures.empty?
@@ -52,6 +52,12 @@ class ScrapeTogglJob < ApplicationJob
# TODO: What should happen if the time entry is materially before the lecture?
kind:
) and next
elsif (work_item = course.work_items.find_by(title: entry_title))
work_item.tracked_time_entries.create!(
toggl_data: entry,
associated_toggl_entry_id: entry['time_entries'][0]['id'],
kind: :generic
) and next
end
concurrent_unlabeled = entry['time_entries'].any? do |inner_entry|