Skip to content

Commit

Permalink
nix the string interpolation
Browse files Browse the repository at this point in the history
thanks Keenan and Jason :)
  • Loading branch information
d-m-u committed May 8, 2020
1 parent 341ece6 commit ba56cfa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/mixins/aggregation_mixin/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def all_storages
end

def aggregate_hardware(from, field, targets = nil)
from = from.to_s.singularize
from = from.to_s.singularize.to_sym
select = field == :aggregate_cpu_speed ? "cpu_total_cores, cpu_speed" : field
targets ||= send("all_#{from}_ids")
targets = targets.collect(&:id) unless targets.first.kind_of?(Integer)
hdws = Hardware.where("#{from}_id".to_sym => targets).select(select)
hdws = Hardware.where(from => targets).select(select)

hdws.inject(0) { |t, hdw| t + hdw.send(field).to_i }
end
Expand Down

0 comments on commit ba56cfa

Please sign in to comment.