Redo simulations lifecycle #222
| @ -41,16 +41,5 @@ class Guest < ApplicationRecord | |||||||
| 
 | 
 | ||||||
|   scope :potential, -> { where.not(status: %i[declined considered]) } |   scope :potential, -> { where.not(status: %i[declined considered]) } | ||||||
| 
 | 
 | ||||||
|   after_destroy :recalculate_simulations |  | ||||||
|   after_save :recalculate_simulations, if: :saved_change_to_status? |  | ||||||
| 
 |  | ||||||
|   has_many :seats, dependent: :delete_all |   has_many :seats, dependent: :delete_all | ||||||
| 
 |  | ||||||
|   private |  | ||||||
| 
 |  | ||||||
|   def recalculate_simulations |  | ||||||
|     TablesArrangement.delete_all |  | ||||||
| 
 |  | ||||||
|     ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new(wedding_id) }) |  | ||||||
|   end |  | ||||||
| end | end | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user