unepwcmc/SAPI

View on GitHub
app/workers/event_eu_suspension_copy_worker.rb

Summary

Maintainability
A
0 mins
Test Coverage
class EventEuSuspensionCopyWorker
  include Sidekiq::Worker
  sidekiq_options :queue => :admin, :retry => false, :backtrace => 50

  def perform(from_event_id, to_event_id)
    ApplicationRecord.connection.execute <<-SQL
      SELECT * FROM copy_eu_suspensions_across_events(
        #{from_event_id.to_i},
        #{to_event_id.to_i}
      )
    SQL
    eu_suspension_regulation = EuSuspensionRegulation.find(to_event_id)
    eu_suspension_regulation.touch_suspensions_and_taxa
  end
end