Class: GelsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- GelsController
- Defined in:
- app/controllers/gels_controller.rb
Constant Summary
Constants included from FlashTruncation
FlashTruncation::STRING_OVERHEAD
Instance Method Summary collapse
- #find ⇒ Object
- #index ⇒ Object
- #lookup ⇒ Object
- #show ⇒ Object
-
#update ⇒ Object
rubocop:todo Metrics/AbcSize.
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
#find ⇒ Object
18 19 |
# File 'app/controllers/gels_controller.rb', line 18 def find end |
#index ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/gels_controller.rb', line 12 def index # TODO: if a plate has a working dilution plate and it has a gel dilution plate, display: @gel_plates = GelDilutionPlate.page(params[:page]).order(id: :desc) @plates = @gel_plates.filter_map(&:stock_plate) end |
#lookup ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/gels_controller.rb', line 21 def lookup @plate = Plate.([params[:barcode], "#{Plate.default_prefix}#{params[:barcode]}"]) unless @plate flash.now[:error] = 'plate not found' render action: :find return end render action: :show end |
#show ⇒ Object
32 33 34 |
# File 'app/controllers/gels_controller.rb', line 32 def show @plate = Plate.find(params[:id]) end |
#update ⇒ Object
rubocop:todo Metrics/AbcSize
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/gels_controller.rb', line 36 def update # rubocop:todo Metrics/AbcSize ActiveRecord::Base.transaction do params[:wells].keys.each do |well_id| well = Well.find(well_id) well.well_attribute.update!(gel_pass: params[:wells][well_id][:qc_state]) well.events.create_gel_qc!(params[:wells][well_id][:qc_state], current_user) end Plate.find(params[:id]).events.create_gel_qc!('', current_user) end flash[:notice] = 'Gel results for plate updated' redirect_to action: :index end |