Class: SpreeCmCommissioner::MaintenanceTasks::Event

Inherits:
SpreeCmCommissioner::MaintenanceTask show all
Defined in:
app/models/spree_cm_commissioner/maintenance_tasks/event.rb

Constant Summary collapse

REFINALIZE_GUESTS_BATCH_SIZE =
ENV.fetch('MAINTENANCE_TASKS_REFINALIZE_GUESTS_BATCH_SIZE', '300').to_i

Constants inherited from SpreeCmCommissioner::MaintenanceTask

SpreeCmCommissioner::MaintenanceTask::MAX_ATTEMPTS

Instance Method Summary collapse

Methods inherited from SpreeCmCommissioner::MaintenanceTask

#async_execute, #execute

Instance Method Details

#maintainObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/spree_cm_commissioner/maintenance_tasks/event.rb', line 6

def maintain
  return unless maintainable.event?

  maintainable.children_classifications.find_each do |product_taxon|
    update_conversion_for(product_taxon)
  end

  # These steps can be expensive and our new order state machine already prevents most cases from happening.
  # So we should only run them as manual maintenance just in case we missed some edge cases.
  reassign_guests_event_id if manually_triggered?
  refinalize_guests if manually_triggered?
end