Update date parameters and simplify broadcast call
This commit is contained in:
parent
af3f2ca39d
commit
39554fb176
@ -20,8 +20,8 @@ class ScrapeTogglJob < ApplicationJob
|
||||
toggl_project_id,
|
||||
|
||||
# TODO: Work out better limits
|
||||
start_time: Time.new('2023-01-01'),
|
||||
end_time: Time.new('2024-01-01')
|
||||
start_time: course.semester_start_date - 2.months,
|
||||
end_time: course.semester_start_date + 15.weeks + 2.months,
|
||||
)
|
||||
|
||||
puts("Entries data for #{course.title}: #{entries_data}")
|
||||
@ -88,7 +88,7 @@ class ScrapeTogglJob < ApplicationJob
|
||||
associated_toggl_entry_id: entry['time_entries'][0]['id'],
|
||||
)
|
||||
|
||||
broadcast_update_to lecture, :status
|
||||
lecture.broadcast_update
|
||||
elsif (lecture_title_match = entry_title.match(review_regex)) and (lecture = lectures.find_by(title: lecture_title_match[1]))
|
||||
lecture.tracked_time_entries.create!(
|
||||
kind: :review,
|
||||
@ -96,7 +96,7 @@ class ScrapeTogglJob < ApplicationJob
|
||||
associated_toggl_entry_id: entry['time_entries'][0]['id'],
|
||||
)
|
||||
|
||||
broadcast_update_to lecture, :status
|
||||
lecture.broadcast_update
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -17,8 +17,8 @@ module Toggl
|
||||
"#{TOGGL_PORTAL_URL}/report",
|
||||
body: {
|
||||
# TODO: Replace these, rails keeps complaining about deprecations
|
||||
"start_date": start_time.to_date.to_fs(),
|
||||
"end_date": end_time.to_date.to_fs(),
|
||||
"start_date": start_time.to_date.to_fs(:db),
|
||||
"end_date": end_time.to_date.to_fs(:db),
|
||||
"project_ids": [toggl_project_id]
|
||||
}.to_json,
|
||||
headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user