Class: RobotVerificationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RobotVerificationsController
- Defined in:
- app/controllers/robot_verifications_controller.rb
Constant Summary
Constants included from FlashTruncation
FlashTruncation::STRING_OVERHEAD
Instance Method Summary collapse
- #barcode_hash ⇒ Object
-
#download ⇒ Object
Step 3: Receives the submission form and checks if it is valid.
- #find_barcodes ⇒ Object
-
#index ⇒ Object
Step 1: Renders a form asking for user barcode, batch barcode, robot barcode and destination plate barcode.
-
#submission ⇒ Object
Step 2: Renders the bed verification form, in which the user is expected to scan in all beds and plates This is generated based on the information provided in step 1.
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
#barcode_hash ⇒ Object
59 60 61 |
# File 'app/controllers/robot_verifications_controller.rb', line 59 def params.require(:barcodes) end |
#download ⇒ Object
Step 3: Receives the submission form and checks if it is valid. In the event it is valid provides a link to download the gwl/csv driver file for the robot. Otherwise redirects the user back to step 1 with an error message.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/robot_verifications_controller.rb', line 37 def download # rubocop:todo Metrics/AbcSize, Metrics/MethodLength @robot = Robot.find(params[:robot_id]) @robot_verification = @robot.verification_behaviour if @robot_verification.valid_submission?(params) @robot_verification.record_plate_types(params[:plate_types]) @batch = Batch.find(params[:batch_id]) @batch.robot_verified!(params[:user_id]) @destination_plate_id = Plate.(params[:destination_plate_barcodes].keys.first). @pick_number = params[:pick_number] else flash[:error] = "Error: #{@robot_verification.errors.join('; ')}" redirect_to action: :index end end |
#find_barcodes ⇒ Object
53 54 55 56 57 |
# File 'app/controllers/robot_verifications_controller.rb', line 53 def @robot = Robot.([:robot_barcode]) @batch = Batch.([:batch_barcode]) @user = User.([:user_barcode]) end |
#index ⇒ Object
Step 1: Renders a form asking for user barcode, batch barcode, robot barcode and destination plate barcode
6 7 |
# File 'app/controllers/robot_verifications_controller.rb', line 6 def index end |
#submission ⇒ Object
Step 2: Renders the bed verification form, in which the user is expected to scan in all beds and plates This is generated based on the information provided in step 1. rubocop:todo Metrics/MethodLength
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/robot_verifications_controller.rb', line 12 def submission # rubocop:todo Metrics/AbcSize errors = [] if @robot.nil? errors << "Could not find robot #{[:robot_barcode]}" else @robot_verification = @robot.verification_behaviour @robot_verification.() { || errors.push() } end if errors.empty? @pick_number = Batch.extract_pick_number([:batch_barcode]) @dest_plates, @source_plates, @ctrl_plates = @robot.pick_number_to_expected_layout(@batch, [:destination_plate_barcode])[@pick_number] else flash[:error] = errors redirect_to action: :index end end |