Class: BudgetRefresherWorkerWithStatus
- Inherits:
-
Object
- Object
- BudgetRefresherWorkerWithStatus
show all
- Includes:
- Sidekiq::Job, Workers::StatusBroadcastable
- Defined in:
- app/workers/budget_refresher_worker_with_status.rb
Instance Attribute Summary
#broadcast_status_updates
Instance Method Summary
collapse
#at, #store, #total
Instance Method Details
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/workers/budget_refresher_worker_with_status.rb', line 8
def perform(options = {})
options = options.with_indifferent_access
year = options[:year].to_i
month = options[: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...')
Analytic::BudgetFact.refresh_data_for_month(year, month) do |step, message|
at(3 + (step.to_f / 100).round(1), message) if step && message
end
at(4, 'Batch inserting budget facts...')
at(5, 'Complete!')
store redirect_to: "/reports/budget?company=all&date[year]=#{year}&date[month]=#{month}"
end
|