Commit a359d510 authored by Arturo Herrero's avatar Arturo Herrero

Remove extra_hash variable

This information is already included as part of the service_hash.
parent edccbcb6
# frozen_string_literal: true # frozen_string_literal: true
class ServiceList class ServiceList
def initialize(batch, service_hash, extra_hash = {}) def initialize(batch, service_hash)
@batch = batch @batch = batch
@service_hash = service_hash @service_hash = service_hash
@extra_hash = extra_hash
end end
def to_array def to_array
...@@ -13,15 +12,15 @@ class ServiceList ...@@ -13,15 +12,15 @@ class ServiceList
private private
attr_reader :batch, :service_hash, :extra_hash attr_reader :batch, :service_hash
def columns def columns
(service_hash.keys << 'project_id') + extra_hash.keys (service_hash.keys << 'project_id')
end end
def values def values
batch.map do |project_id| batch.map do |project_id|
(service_hash.values << project_id) + extra_hash.values (service_hash.values << project_id)
end end
end end
end end
...@@ -61,7 +61,7 @@ module Admin ...@@ -61,7 +61,7 @@ module Admin
end end
def bulk_create_from_integration(batch) def bulk_create_from_integration(batch)
service_list = ServiceList.new(batch, service_hash, { 'inherit_from_id' => integration.id }).to_array service_list = ServiceList.new(batch, service_hash).to_array
Project.transaction do Project.transaction do
results = bulk_insert(*service_list) results = bulk_insert(*service_list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment