Sha256: ed4cb9cb6c1ec8713f1484e948fddc2852d6272eee37431e8023e57f0e6d0511

Contents?: true

Size: 584 Bytes

Versions: 16

Compression:

Stored size: 584 Bytes

Contents

class AlertExecution
  @queue = :alert_exec

  def self.perform(alert_id, role)
    alert = Alert.find(alert_id)
    alert.status = Alert::STATUSES.pending
    alert.save!

    interaction = Interaction::ResultCreation.new(
      query_version_id: alert.latest_query_version.id,
      owner: alert.user
    )

    result = interaction.execute

    if interaction.errors.any?
      alert.error(interaction.errors.join(', '))
    else
      alert.last_alert_result = result
      alert.save!
      QueryExecution.perform(result.id, role)
      alert.check_last_result
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev app/models/alert_execution.rb
aleph_analytics-0.4.8 app/models/alert_execution.rb
aleph_analytics-0.4.7 app/models/alert_execution.rb
aleph_analytics-0.4.4 app/models/alert_execution.rb
aleph_analytics-0.4.2 app/models/alert_execution.rb
aleph_analytics-0.4.1 app/models/alert_execution.rb
aleph_analytics-0.3.0 app/models/alert_execution.rb
aleph_analytics-0.2.0 app/models/alert_execution.rb
aleph_analytics-0.1.0 app/models/alert_execution.rb
aleph_analytics-0.0.6 app/models/alert_execution.rb
aleph_analytics-0.0.5 app/models/alert_execution.rb
aleph_analytics-0.0.4 app/models/alert_execution.rb
aleph_analytics-0.0.3 app/models/alert_execution.rb
aleph_analytics-0.0.2 app/models/alert_execution.rb
aleph_analytics-0.0.1.alpha app/models/alert_execution.rb
aleph_analytics-0.0.0.alpha app/models/alert_execution.rb