Class: GenerateMultipleRoomPlansWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job, Workers::StatusBroadcastable
Defined in:
app/workers/generate_multiple_room_plans_worker.rb

Instance Attribute Summary

Attributes included from Workers::StatusBroadcastable

#broadcast_status_updates

Instance Method Summary collapse

Methods included from Workers::StatusBroadcastable::Overrides

#at, #store, #total

Instance Method Details

#perform(options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/workers/generate_multiple_room_plans_worker.rb', line 7

def perform(options)
  room_configuration_ids = options[:room_configuration_ids]
  total room_configuration_ids.size
  current_step = 0
  message = ""
  room_configuration_ids.each do |room_configuration_id|
    rc = RoomConfiguration.find(room_configuration_id)
    current_step += 1
    message = "Refreshing plans for #{rc.reference_number}"
    at(current_step, message)
    rc.generate_all_plans
  end
  store redirect_to: options[:on_finish_redirect_to]
  message = "Successfully re-generated plans for #{room_configuration_ids.size} room(s)/area(s)."
  store message: message
end