Skip to content

Commit

Permalink
Set @options only once
Browse files Browse the repository at this point in the history
There are three possible callers of build_results_for_report_chargeback
each of them sets @options to the same value that is later passed in as
an argument.

Let's have a single place to set it.

In future I want to get a rid of class variable. But it will take few
moments before we get there.
  • Loading branch information
isimluk committed Oct 24, 2016
1 parent 743893b commit 52a00de
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions app/models/chargeback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Chargeback < ActsAsArModel

def self.build_results_for_report_chargeback(options)
_log.info("Calculating chargeback costs...")
@options = options

tz = Metric::Helper.get_time_zone(options[:ext_options])
# TODO: Support time profiles via options[:ext_options][:time_profile]
Expand Down
1 change: 0 additions & 1 deletion app/models/chargeback_container_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def self.build_results_for_report_ChargebackContainerImage(options)
# :entity_id => 1/2/3.../all rails id of entity

# Find Project by id or get all projects
@options = options
provider_id = options[:provider_id]
id = options[:entity_id]
raise "must provide option :entity_id and provider_id" if id.nil? && provider_id.nil?
Expand Down
1 change: 0 additions & 1 deletion app/models/chargeback_container_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def self.build_results_for_report_ChargebackContainerProject(options)
# :entity_id => 1/2/3.../all rails id of entity

# Find ContainerProjects according to any of these:
@options = options
provider_id = options[:provider_id]
project_id = options[:entity_id]
filter_tag = options[:tag]
Expand Down
1 change: 0 additions & 1 deletion app/models/chargeback_vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def self.build_results_for_report_ChargebackVm(options)
end
return [[]] if vms.empty?

@options = options
@vm_owners = vms.inject({}) { |h, v| h[v.id] = v.evm_owner_name; h }

build_results_for_report_chargeback(options)
Expand Down

0 comments on commit 52a00de

Please sign in to comment.