Class: QuadStampController

Inherits:
ApplicationController show all
Defined in:
app/controllers/quad_stamp_controller.rb

Overview

Handles transfer of 1-4 96 well plates or tube racks onto a single new 384 well plate

Constant Summary

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createObject

rubocop:todo Metrics/AbcSize, Metrics/MethodLength



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/quad_stamp_controller.rb', line 16

def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
  @user = User.find_with_barcode_or_swipecard_code(params[:quad_creator][:user_barcode])
  @target_purpose = Purpose.find(params[:quad_creator][:target_purpose_id])
  @quad_creator =
    Plate::QuadCreator.new(parent_barcodes: parent_barcodes.to_hash, target_purpose: @target_purpose, user: @user)

  if @quad_creator.save
    print_labels
    redirect_to labware_path(@quad_creator.target_plate),
                notice: "A new #{@target_purpose.name} plate was created and labels printed"
  else
    render :new
  end
end

#newObject



8
9
10
11
12
13
14
# File 'app/controllers/quad_stamp_controller.rb', line 8

def new
  @quad_creator = Plate::QuadCreator.new

  respond_to do |format|
    format.html # new.html.erb
  end
end