Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use get_or_create_single_model when appropriate.

DRY the aliquot creation and fix a bug not adding the created aliquot to
the persistor and/or the session.
  • Loading branch information...
commit 2fb542f5871b3d803219009bdce7743014c2cda6 1 parent f1aee11
maxigit maxigit authored
2  lib/lims-core/persistence/sequel/flowcell.rb
View
@@ -31,7 +31,7 @@ def load_aliquots(flowcell_id)
Lane::dataset(@session).join(Aliquot::dataset(@session), :id => :aliquot_id).filter(:flowcell_id => flowcell_id).each do |att|
position = att.delete(:position)
att.delete(:id)
- aliquot = @session.aliquot[:aliquot_id] || Aliquot::Model.new(att)
+ aliquot = @session.aliquot.get_or_create_single_model(att[:aliquot_id]) { Aliquot::Model.new(att) }
yield(position, aliquot)
end
end
2  lib/lims-core/persistence/sequel/plate.rb
View
@@ -31,7 +31,7 @@ def load_aliquots(plate_id)
Well::dataset(@session).join(Aliquot::dataset(@session), :id => :aliquot_id).filter(:plate_id => plate_id).each do |att|
position = att.delete(:position)
att.delete(:id)
- aliquot = @session.aliquot[:aliquot_id] || Aliquot::Model.new(att)
+ aliquot = @session.aliquot.get_or_create_single_model(att[:aliquot_id]) { Aliquot::Model.new(att) }
yield(position, aliquot)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.