Skip to content

Commit

Permalink
Unpadded locations where creating a problem of not finding locations in
Browse files Browse the repository at this point in the history
plates an tuberack
  • Loading branch information
emrojo committed Nov 5, 2019
1 parent 21c7599 commit 38a1375
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions script/runners/move_barcodes_from_tube_rack_to_plate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ def wells_for(asset)
end

def well_at_location(asset, location)
wells_for(asset).select{|w| w.facts.where(predicate: 'location', object: location).count > 0}.first
wells_for(asset).select do |w|
location_facts = w.facts.where(predicate: 'location')
if (location_facts.count == 1)
location_fact = location_facts.first
(TokenUtil.pad_location(location_fact.object) == TokenUtil.pad_location(location))
end
end.first
end

def traverse_wells(asset, &block)
wells_for(asset).each do |w|
location = w.facts.where(predicate: 'location').first.object
yield w, location
yield w, TokenUtil.pad_location(location)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@
let(:barcodes) {
NUM_WELLS.times.map{|i| "FR00#{i}"}
}
let(:padded_locations) {
NUM_WELLS.times.map{|i| "A0#{i}"}
}

let(:locations) {
NUM_WELLS.times.map{|i| "A#{i}"}
}
let(:wells_for_rack) {
NUM_WELLS.times.map do |i|
asset = create(:asset, barcode: barcodes[i])
asset.facts << create(:fact, predicate: 'a', object: 'Tube')
asset.facts << create(:fact, predicate: 'location', object: locations[i])
asset.facts << create(:fact, predicate: 'location', object: padded_locations[i])
asset
end
}
Expand Down

0 comments on commit 38a1375

Please sign in to comment.