Class: UatActions::GenerateFluidxBarcodes

Inherits:
UatActions
  • Object
show all
Defined in:
app/uat_actions/uat_actions/generate_fluidx_barcodes.rb

Overview

UAT action to generate randomised FluidX barcodes in the following format: : Ten characters in total : two uppercase letters : six random digits; may be truncated from the end to fit the length : : one digit that separates random part and index, i.e. '0' : sequential tail, 1 to 3 digits, e.g., '9', '99', and '999'

Sequential tail in barcodes may be higher and may have gaps because of handling duplicates. Random part may be truncated from right to fit the length of the barcode.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaultUatActions::GenerateFluidxBarcodes

Returns a default copy of the UatAction which will be used to fill in the form.

Returns:



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'app/uat_actions/uat_actions/generate_fluidx_barcodes.rb', line 94

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

Instance Method Details

#performBoolean

This method is called from the save method after validations have passed. If the return value is true, the report hash populated by the action is used for rendering the response. If the return value is false, the errors collection is used.

Returns:

  • (Boolean)

    true if the action was successful; false otherwise



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'app/uat_actions/uat_actions/generate_fluidx_barcodes.rb', line 79

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end