diff --git a/app/jobs/pretalx/import_job.rb b/app/jobs/pretalx/import_job.rb index 58ebf3cdaa4412de90c85a870b2961071042411b..36d817bfde7b19c9a89dbd7c6b3da7c978407df1 100644 --- a/app/jobs/pretalx/import_job.rb +++ b/app/jobs/pretalx/import_job.rb @@ -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