Class: BudgetRefresherWorkerWithStatus
- Inherits:
-
Object
- Object
- BudgetRefresherWorkerWithStatus
- Includes:
- Sidekiq::Job, Workers::StatusBroadcastable
- Defined in:
- app/workers/budget_refresher_worker_with_status.rb
Overview
Namespace for BudgetRefresherWorkerWithStatus workers.
Instance Attribute Summary
Attributes included from Workers::StatusBroadcastable
Instance Method Summary collapse
Methods included from Workers::StatusBroadcastable::Overrides
Instance Method Details
#perform(options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/workers/budget_refresher_worker_with_status.rb', line 10 def perform( = {}) year = [:year].to_i month = [:month].to_i total 5 at(1, "Initializing budget refresh for #{Date::MONTHNAMES[month]} #{year}...") at(2, 'Pre-loading reference data (projects, suppliers)...') at(3, 'Computing ledger and budget aggregates...') # Pass a progress callback to the refresh method Analytic::BudgetFact.refresh_data_for_month(year, month) do |step, | # Steps 3-4 are for the main processing at(3 + (step.to_f / 100).round(1), ) if step && end at(4, 'Batch inserting budget facts...') at(5, 'Complete!') store redirect_to: "/reports/budget?company=all&date[year]=#{year}&date[month]=#{month}" end |