Class: UatActions::GeneratePlates

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

Overview

Will construct plates with well_count wells filled with samples rubocop:disable Metrics/ClassLength

Direct Known Subclasses

GenerateTaggedPlates

Constant Summary collapse

ERROR_WELL_COUNT_EXCEEDS_PLATE_SIZE =
"Well count of %s exceeds the plate size of %s for the plate purpose '%s'."
ERROR_PLATE_PURPOSE_DOES_NOT_EXIST =
"Plate purpose '%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

.defaultObject



76
77
78
79
80
81
82
83
84
85
# File 'app/uat_actions/uat_actions/generate_plates.rb', line 76

def self.default
  new(
    plate_count: 1,
    well_count: 96,
    number_of_samples_in_each_well: 1,
    study_name: UatActions::StaticRecords.study.name,
    plate_purpose_name: PlatePurpose.stock_plate_purpose.name,
    well_layout: 'Column'
  )
end

Instance Method Details

#performObject



87
88
89
90
91
92
93
94
95
96
# File 'app/uat_actions/uat_actions/generate_plates.rb', line 87

def perform
  plate_count.to_i.times do |i|
    plate_purpose.create!.tap do |plate|
      construct_wells(plate)
      report["plate_#{i}"] = plate.human_barcode
      yield plate if block_given?
    end
  end
  true
end