Skip to content
Snippets Groups Projects
Verified Commit 223d3f60 authored by Felix Eckhofer's avatar Felix Eckhofer :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 ...@@ -34,12 +34,12 @@ module Pretalx
end 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. # 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| schedule['schedule']['conference']['days'].each do |day_data|
day_data['rooms'].each do |stage_name, stage_data| day_data['rooms'].each do |stage_name, stage_data|
stage = stages[stage_name] stage = stages[stage_name]
stage_data.each do |session_data| 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.find_or_initialize_by(conference:, ref_id: session_data['guid']).tap do |session|
session.stage = stage session.stage = stage
session.title = session_data['title'] session.title = session_data['title']
...@@ -64,7 +64,7 @@ module Pretalx ...@@ -64,7 +64,7 @@ module Pretalx
end end
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.stage = canceled_stage
canceled.save! canceled.save!
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment