Class: UatActions::TestSubmission

Inherits:
UatActions show all
Includes:
Shared::StudyHelper
Defined in:
app/uat_actions/uat_actions/test_submission.rb

Overview

Will construct submissions Currently VERY basic

Constant Summary collapse

ERROR_SUBMISSION_TEMPLATE_DOES_NOT_EXIST =
"Submission template '%s' does not exist."
ERROR_PLATE_DOES_NOT_EXIST =
'Plate with barcode %s does not exist.'
ERROR_PLATE_PURPOSE_DOES_NOT_EXIST =
"Plate purpose '%s' does not exist."
ERROR_LIBRARY_TYPE_DOES_NOT_EXIST =
"Library type '%s' does not exist."
ERROR_PRIMER_PANEL_DOES_NOT_EXIST =
"Primer panel '%s' does not exist."
ERROR_STUDY_DOES_NOT_EXIST =
"Study '%s' does not exist."
ERROR_PROJECT_DOES_NOT_EXIST =
"Project '%s' does not exist."

Constants inherited from UatActions

CATEGORY_LIST

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from UatActions

all, category, find, form_field, form_fields, grouped_and_sorted_uat_actions, id, inherited, permitted, #report, #save, to_partial_path, uat_actions

Class Method Details

.compatible_submission_templatesObject



144
145
146
147
148
149
150
151
152
# File 'app/uat_actions/uat_actions/test_submission.rb', line 144

def self.compatible_submission_templates
  SubmissionTemplate
    .visible
    .each_with_object([]) do |submission_template, compatible|
      next unless submission_template.input_asset_type == 'Well'

      compatible << submission_template.name
    end
end

.defaultUatActions::TestSubmission

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

Returns:



140
141
142
# File 'app/uat_actions/uat_actions/test_submission.rb', line 140

def self.default
  new(number_of_samples_in_each_well: 1)
end

Instance Method Details

#performBoolean

Generates a plate submission for the given template. A partial submission is possible if the number_of_wells_to_submit form field has been set.

rubocop:todo Metrics/MethodLength

Returns:

  • (Boolean)

    Returns true if the action was successful, false otherwise



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'app/uat_actions/uat_actions/test_submission.rb', line 160

def perform # rubocop:todo Metrics/AbcSize
  order =
    submission_template.create_with_submission!(
      study: study,
      project: project,
      user: user,
      assets: assets,
      request_options: order_request_options
    )
  report['plate_barcode_0'] = labware.human_barcode
  report['submission_id'] = order.submission.id
  report['library_type'] = order.request_options[:library_type] if order.request_options[:library_type].present? &&
    order.request_options[:library_type] != 0
  report['primer_panel'] = order.request_options[:primer_panel_name] if order.request_options[
    :primer_panel_name
  ].present?
  report['study_name'] = order.study.name
  report['project_name'] = order.project.name
  report['number_of_wells_with_samples'] = labware.wells.with_aliquots.size
  report['number_of_samples_in_each_well'] = labware.wells.with_aliquots.first.aliquots.size
  report['number_of_wells_to_submit'] = assets.size
  order.submission.built!
  true
end