Class: TagLayout::TemplateSubmission

Inherits:
ApplicationRecord show all
Defined in:
app/models/tag_layout/template_submission.rb

Overview

Stores a record of which templates have been used in which submission This ensures that a tag clash is not introduced prior to later pooling. We can also enforce uniqueness at the database level, eliminating race conditions when multiple plates get processed at the same time. This is a genuine risk, as the users often process multiple plates in parallel and processing time is non-trivial.

A note on future changes: Once we’ve solved the duplicate-tag-sequences problems it might make sense to actually track tag sequence pairs here, but hopefully by that point we’ll be pooling flexibly anyway. We’d probably also still need to be able to show which templates had been used, as a huge list of oligo sequences isn’t very user friendly.

Author:

  • Genome Research Ltd.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Attribute Details

#enforce_uniquenessnil, true

Returns true to enforce uniqueness of a template within a submission or nil to allow duplicate templates. This is enforced at the database level.

Returns:

  • (nil, true)

    true to enforce uniqueness of a template within a submission or nil to allow duplicate templates. This is enforced at the database level



28
# File 'app/models/tag_layout/template_submission.rb', line 28

validates :tag_layout_template, uniqueness: { scope: :submission }, if: :enforce_uniqueness?

Instance Method Details

#coerce_false_enforce_uniqueness_to_nilObject

By setting the value to nil, we can bypass the uniqueness constraint on the database.



35
36
37
# File 'app/models/tag_layout/template_submission.rb', line 35

def coerce_false_enforce_uniqueness_to_nil
  self.enforce_uniqueness = nil if enforce_uniqueness == false
end