Skip to content
Snippets Groups Projects
Verified Commit 223d3f60 authored by tribut's avatar tribut :man_dancing:
Browse files

Only move sessions from relevant stages to canceled

We don't want the "canceled stage" to be filled with talks we've never
even seen before.
parent c79441c0
No related branches found
No related tags found
No related merge requests found
......@@ -34,12 +34,12 @@ module Pretalx
end
# We build a list of sessions that exist in the current version of the fahrplan. That way we can move removed sessions to the "Canceled session" fake stage.
sessions = []
existing_sessions = []
schedule['schedule']['conference']['days'].each do |day_data|
day_data['rooms'].each do |stage_name, stage_data|
stage = stages[stage_name]
stage_data.each do |session_data|
sessions << session_data['guid']
existing_sessions << session_data['guid']
Session.find_or_initialize_by(conference:, ref_id: session_data['guid']).tap do |session|
session.stage = stage
session.title = session_data['title']
......@@ -64,7 +64,7 @@ module Pretalx
end
end
Session.where(conference:).where.not(ref_id: sessions).each do |canceled|
Session.where(conference:).where.not(ref_id: existing_sessions).where(stage: conference.relevant_stages).each do |canceled|
canceled.stage = canceled_stage
canceled.save!
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment