Skip to content
Snippets Groups Projects
Commit 95789e7a authored by Teal's avatar Teal
Browse files

fix schedule for upcoming

parent cc51b1a7
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ class TelegramNotifyUpcomingJob < ApplicationJob ...@@ -2,7 +2,7 @@ class TelegramNotifyUpcomingJob < ApplicationJob
queue_as :default queue_as :default
def perform(**args) def perform(**args)
Session.scheduled.includes(:stage, :assignments).where(stage: { name: ["Stage 1", "Stage 2", "Standby"] }).where(starts_at: Time.now..(Time.now + args[:interval])).order(:starts_at).each do |session| Session.scheduled.includes(:stage, :assignments).where(stage: { name: ["Stage 1", "Stage 2", "Standby"] }).where(starts_at: (Time.now + args[:offset])..(Time.now + args[:offset] + args[:interval])).order(:starts_at).each do |session|
assignees = session.assignments.map(&:user) assignees = session.assignments.map(&:user)
if assignees.length.positive? if assignees.length.positive?
notify_names = assignees.map { |a| a.telegram_username ? "@#{a.telegram_username}" : a.name } notify_names = assignees.map { |a| a.telegram_username ? "@#{a.telegram_username}" : a.name }
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
# #
Crono.perform(FetchConferenceDataJob, 'rp2024').every 5.minutes Crono.perform(FetchConferenceDataJob, 'rp2024').every 5.minutes
Crono.perform(TelegramNotifyUpcomingJob, interval: 15.minutes).every 15.minutes Crono.perform(TelegramNotifyUpcomingJob, offset: 15.minutes, interval: 1.minute).every 1.minute
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment