Class: Decidim::MetricJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/decidim/metric_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(manager_class, organization_id, day = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'app/jobs/decidim/metric_job.rb', line 7

def perform(manager_class, organization_id, day = nil)
  organization = Decidim::Organization.find_by(id: organization_id)
  return unless organization

  metric = manager_class.constantize.new(day, organization)
  metric.save if metric.valid?
end