Skip to content

Commit

Permalink
Fix calling to method
Browse files Browse the repository at this point in the history
  • Loading branch information
emrojo committed Nov 7, 2023
1 parent 2a6bb88 commit 28d74fe
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/controllers/exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def set_filename

def ancestor_tube_details(ancestor_results)
ancestor_results.each_with_object({}) do |ancestor_result, tube_list|
tube = Sequencescape::Api::V2::Tube.find_by(uuid: ancestor_result.uuid)
tube = Sequencescape::Api::V2::Tube.find_by({uuid: ancestor_result.uuid})
tube_sample_uuid = tube.aliquots.first.sample.uuid
tube_list[tube_sample_uuid] = tube if tube_sample_uuid.present?
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/labware_creators/multi_stamp_tubes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def source_tube_outer_request_uuid(tube)
end

def request_hash(transfer, child_plate)
tube = Sequencescape::Api::V2::Tube.find_by(uuid: transfer[:source_tube])
tube = Sequencescape::Api::V2::Tube.find_by({uuid: transfer[:source_tube]})

{
'source_asset' => transfer[:source_asset],
Expand Down
4 changes: 2 additions & 2 deletions app/models/labware_creators/plate_split_to_tube_racks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def tube_barcodes_are_unique?
def check_tube_rack_scan_file(tube_rack_file, msg_prefix)
tube_rack_file.position_details.each do |tube_posn, tube_details|
foreign_barcode = tube_details['tube_barcode']
tube_in_db = Sequencescape::Api::V2::Tube.find_by(barcode: foreign_barcode)
tube_in_db = Sequencescape::Api::V2::Tube.find_by({barcode: foreign_barcode})
next if tube_in_db.blank?

msg = "#{msg_prefix} tube barcode #{foreign_barcode} (at rack position #{tube_posn}) already exists in the LIMS"
Expand Down Expand Up @@ -224,7 +224,7 @@ def locate_ancestor_tubes
return {} if ancestor_results.blank?

ancestor_results.each_with_object({}) do |ancestor_result, tube_list|
tube = Sequencescape::Api::V2::Tube.find_by(uuid: ancestor_result.uuid)
tube = Sequencescape::Api::V2::Tube.find_by({uuid: ancestor_result.uuid})
tube_sample_uuid = tube.aliquots.first.sample.uuid
tube_list[tube_sample_uuid] = tube if tube_sample_uuid.present?
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/labware_creators/pooled_tubes_by_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def locate_ancestor_tubes
return {} if ancestor_results.blank?

ancestor_results.each_with_object({}) do |ancestor_result, tube_list|
tube = Sequencescape::Api::V2::Tube.find_by(uuid: ancestor_result.uuid)
tube = Sequencescape::Api::V2::Tube.find_by({uuid: ancestor_result.uuid})
tube_sample_uuid = tube.aliquots.first.sample.uuid
tube_list[tube_sample_uuid] = tube if tube_sample_uuid.present?
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def tube_must_be_spiked_buffer

# Only call this method if the spikedbuffer_tube_barcode is present
def scanned_tube
@scanned_tube ||= Sequencescape::Api::V2::Tube.find_by(barcode: spikedbuffer_tube_barcode)
search_params = { barcode: spikedbuffer_tube_barcode }
@scanned_tube ||= Sequencescape::Api::V2::Tube.find_by(search_params)
end
end
end
2 changes: 1 addition & 1 deletion app/sequencescape/sequencescape/api/v2/sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Sequencescape::Api::V2::Sample < Sequencescape::Api::V2::Base
DEFAULT_INCLUDES = [].freeze

def self.find_by(options, includes: DEFAULT_INCLUDES)
Sequencescape::Api::V2::Sample.includes(*includes).find(options).first
Sequencescape::Api::V2::Sample.includes(*includes).find(**options).first
end

def species
Expand Down
2 changes: 1 addition & 1 deletion app/sequencescape/sequencescape/api/v2/sample_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class Sequencescape::Api::V2::SampleMetadata < Sequencescape::Api::V2::Base
DEFAULT_INCLUDES = [].freeze

def self.find_by(options, includes: DEFAULT_INCLUDES)
Sequencescape::Api::V2::SampleMetadata.includes(*includes).find(options).first
Sequencescape::Api::V2::SampleMetadata.includes(*includes).find(**options).first
end
end
4 changes: 2 additions & 2 deletions app/sequencescape/sequencescape/api/v2/tube.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class Sequencescape::Api::V2::Tube < Sequencescape::Api::V2::Base
property :updated_at, type: :time

def self.find_by(options, includes: DEFAULT_INCLUDES)
Sequencescape::Api::V2::Tube.includes(*includes).find(options).first
Sequencescape::Api::V2::Tube.includes(*includes).find(**options).first
end

def self.find_all(options, includes: DEFAULT_INCLUDES, paginate: {})
Sequencescape::Api::V2::Tube.includes(*includes).where(options).paginate(paginate).all
Sequencescape::Api::V2::Tube.includes(*includes).where(**options).paginate(paginate).all
end

# Dummied out for the moment. But no real reason not to add it to the API.
Expand Down

0 comments on commit 28d74fe

Please sign in to comment.