Skip to content
Snippets Groups Projects
Commit 12d915dd authored by Teal's avatar Teal
Browse files

relevant stages changes

parent 9eb06684
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ class ConferencesController < ApplicationController ...@@ -5,7 +5,7 @@ class ConferencesController < ApplicationController
def show def show
@conference = Conference.find_by(slug: params[:slug]) @conference = Conference.find_by(slug: params[:slug])
@sessions = @conference.sessions.where.not(starts_at: nil).includes(:stage, :assignments).where(stage: { name: ["Stage 1", "Stage 2", "Standby"] }).order(:starts_at) @sessions = @conference.sessions.where.not(starts_at: nil).includes(:stage, :assignments).where(stage: @conference.relevant_stages).order(:starts_at)
if params[:date] if params[:date]
date = Time.parse(params[:date]) date = Time.parse(params[:date])
logger.debug(date) logger.debug(date)
......
...@@ -4,7 +4,7 @@ class TelegramNotifyUpcomingJob < ApplicationJob ...@@ -4,7 +4,7 @@ class TelegramNotifyUpcomingJob < ApplicationJob
def perform(args) def perform(args)
offset = args["offset"] offset = args["offset"]
interval = args["interval"] interval = args["interval"]
Session.scheduled.includes(:stage, :assignments).where(stage: { name: ["Stage 1", "Stage 2", "Standby"] }).where(starts_at: (Time.now + offset)..(Time.now + offset + interval)).order(:starts_at).each do |session| Session.scheduled.includes(:stage, :assignments).where(stage: RelevantStage.joins(:stage).map(&:stage)).where(starts_at: (Time.now + offset)..(Time.now + offset + interval)).order(:starts_at).each do |session|
puts session.inspect puts session.inspect
assignees = session.assignments.map(&:user) assignees = session.assignments.map(&:user)
if assignees.length.positive? if assignees.length.positive?
......
...@@ -27,18 +27,20 @@ class Session < ApplicationRecord ...@@ -27,18 +27,20 @@ class Session < ApplicationRecord
super.in_time_zone(conference.time_zone) super.in_time_zone(conference.time_zone)
end end
def is_interpreted def is_interpreted?
# XXX is_relevant?
["Stage 1", "Stage 2"].include? stage.name end
def is_relevant?
RelevantStage.exists?(stage:)
end end
def translators_needed? def translators_needed?
is_interpreted && assignments.length < 2 is_interpreted? && assignments.length < 2
end end
def backup_needed? def backup_needed?
return false return false
# is_interpreted && assignments.length < 4
end end
def assignees? def assignees?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment