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
def show
@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]
date = Time.parse(params[:date])
logger.debug(date)
......
......@@ -4,7 +4,7 @@ class TelegramNotifyUpcomingJob < ApplicationJob
def perform(args)
offset = args["offset"]
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
assignees = session.assignments.map(&:user)
if assignees.length.positive?
......
......@@ -27,18 +27,20 @@ class Session < ApplicationRecord
super.in_time_zone(conference.time_zone)
end
def is_interpreted
# XXX
["Stage 1", "Stage 2"].include? stage.name
def is_interpreted?
is_relevant?
end
def is_relevant?
RelevantStage.exists?(stage:)
end
def translators_needed?
is_interpreted && assignments.length < 2
is_interpreted? && assignments.length < 2
end
def backup_needed?
return false
# is_interpreted && assignments.length < 4
end
def assignees?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment