Module: Tasks::PlateTemplateHandler
- Included in:
- WorkflowsController
- Defined in:
- app/models/tasks/plate_template_handler.rb
Overview
Gets included in the WorkflowsController and adds a load of methods to handle the first step of cherrypicking (selecting templates etc.) Not a great pattern to follow, although its very prevalent in the workflows.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.generate_spreadsheet(batch) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/models/tasks/plate_template_handler.rb', line 14 def self.generate_spreadsheet(batch) CSV.generate(row_sep: "\r\n") do |csv| csv << ['Request ID', 'Sample Name', 'Source Plate', 'Source Well', 'Plate', 'Destination Well'] batch.requests.each do |r| csv << [r.id, r.asset.samples.first&.name, r.asset.plate., r.asset.map_description, '', ''] end end end |
Instance Method Details
#render_plate_template_task(task, _params) ⇒ Object
7 8 9 10 11 12 |
# File 'app/models/tasks/plate_template_handler.rb', line 7 def render_plate_template_task(task, _params) @robots = Robot.all @plate_purpose_options = task.(@batch) suitable_sizes = @plate_purpose_options.pluck(1).uniq @plate_templates = PlateTemplate.with_sizes(suitable_sizes) end |