Class: GetYourQcCompletedTubesHereController

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

Overview

rubocop:todo Style/Documentation

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/MethodLength


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/get_your_qc_completed_tubes_here_controller.rb', line 8

def create # rubocop:todo Metrics/AbcSize
  @generator =
    LibPoolNormTubeGenerator.new(params[:barcode], current_user, Study.find_by(name: 'Lib PCR-XP QC Completed Tubes'))
  if @generator.valid?
    if @generator.create!
      flash[:notice] = "QC Completed tubes successfully created for #{@generator.plate.human_barcode}. Go celebrate!"
      redirect_to study_asset_groups_path(@generator.study.id)
    else
      flash.now[:error] = "Oh dear, your tubes weren't created. It's not you its me so please contact PSD."
      render :new
    end
  else
    flash.now[:error] = @generator.errors.full_messages.join(', ')
    render :new
  end
end

#newObject


5
# File 'app/controllers/get_your_qc_completed_tubes_here_controller.rb', line 5

def new; end