Class: StockStamper
- Inherits:
-
Object
- Object
- StockStamper
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/stock_stamper.rb
Instance Attribute Summary collapse
-
#destination_plate_barcode ⇒ Object
Returns the value of attribute destination_plate_barcode.
-
#destination_plate_type_name ⇒ Object
Returns the value of attribute destination_plate_type_name.
-
#file_content ⇒ Object
Returns the value of attribute file_content.
-
#overage ⇒ Object
Returns the value of attribute overage.
-
#plate ⇒ Object
readonly
Returns the value of attribute plate.
-
#plate_type ⇒ Object
readonly
Returns the value of attribute plate_type.
-
#source_plate_barcode ⇒ Object
Returns the value of attribute source_plate_barcode.
-
#source_plate_type_name ⇒ Object
Returns the value of attribute source_plate_type_name.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#user_barcode ⇒ Object
Returns the value of attribute user_barcode.
Instance Method Summary collapse
- #create_asset_audit_event ⇒ Object
- #execute ⇒ Object
-
#generate_tecan_data ⇒ Object
rubocop:todo Metrics/AbcSize.
- #generate_tecan_gwl_file_as_text ⇒ Object
-
#initialize(attributes = { overage: 1.2 }) ⇒ StockStamper
constructor
A new instance of StockStamper.
- #message ⇒ Object
- #wells_with_excess ⇒ Object
Constructor Details
#initialize(attributes = { overage: 1.2 }) ⇒ StockStamper
Returns a new instance of StockStamper.
26 27 28 |
# File 'app/models/stock_stamper.rb', line 26 def initialize(attributes = { overage: 1.2 }) super end |
Instance Attribute Details
#destination_plate_barcode ⇒ Object
Returns the value of attribute destination_plate_barcode.
5 6 7 |
# File 'app/models/stock_stamper.rb', line 5 def @destination_plate_barcode end |
#destination_plate_type_name ⇒ Object
Returns the value of attribute destination_plate_type_name.
11 12 13 |
# File 'app/models/stock_stamper.rb', line 11 def destination_plate_type_name @destination_plate_type_name end |
#file_content ⇒ Object
Returns the value of attribute file_content.
5 6 7 |
# File 'app/models/stock_stamper.rb', line 5 def file_content @file_content end |
#overage ⇒ Object
Returns the value of attribute overage.
5 6 7 |
# File 'app/models/stock_stamper.rb', line 5 def overage @overage end |
#plate ⇒ Object (readonly)
Returns the value of attribute plate.
11 12 13 |
# File 'app/models/stock_stamper.rb', line 11 def plate @plate end |
#plate_type ⇒ Object (readonly)
Returns the value of attribute plate_type.
11 12 13 |
# File 'app/models/stock_stamper.rb', line 11 def plate_type @plate_type end |
#source_plate_barcode ⇒ Object
Returns the value of attribute source_plate_barcode.
5 6 7 |
# File 'app/models/stock_stamper.rb', line 5 def @source_plate_barcode end |
#source_plate_type_name ⇒ Object
Returns the value of attribute source_plate_type_name.
5 6 7 |
# File 'app/models/stock_stamper.rb', line 5 def source_plate_type_name @source_plate_type_name end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
11 12 13 |
# File 'app/models/stock_stamper.rb', line 11 def user @user end |
#user_barcode ⇒ Object
Returns the value of attribute user_barcode.
5 6 7 |
# File 'app/models/stock_stamper.rb', line 5 def @user_barcode end |
Instance Method Details
#create_asset_audit_event ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'app/models/stock_stamper.rb', line 79 def create_asset_audit_event AssetAudit.create( asset_id: plate.id, key: 'stamping_of_stock', message: "Process 'Stamping of stock' performed", created_by: user.login ) end |
#execute ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/models/stock_stamper.rb', line 30 def execute generate_tecan_gwl_file_as_text create_asset_audit_event if wells_with_excess.present? [:error] = "Required volume exceeds the maximum well volume for well(s) #{wells_with_excess.join(', ')}." \ " Maximum well volume #{plate_type.maximum_volume.to_f} will be used in tecan file" end [:notice] = 'You can generate the TECAN file and print label now.' end |
#generate_tecan_data ⇒ Object
rubocop:todo Metrics/AbcSize
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/models/stock_stamper.rb', line 46 def generate_tecan_data # rubocop:todo Metrics/AbcSize = "#{plate.}_s" = "#{plate.}_d" data_object = { 'user' => user.login, 'time' => Time.zone.now, 'source' => { => { 'name' => source_plate_type_name.tr('_', "\s"), 'plate_size' => plate.size } }, 'destination' => { => { 'name' => destination_plate_type_name.tr('_', "\s"), 'plate_size' => plate.size, 'mapping' => [] } } } plate.wells.without_blank_samples.each do |well| next unless well.get_current_volume data_object['destination'][]['mapping'] << { 'src_well' => [, well.map.description], 'dst_well' => well.map.description, 'volume' => volume(well), 'buffer_volume' => well.get_buffer_volume } end data_object end |
#generate_tecan_gwl_file_as_text ⇒ Object
40 41 42 43 44 |
# File 'app/models/stock_stamper.rb', line 40 def generate_tecan_gwl_file_as_text picking_data = generate_tecan_data layout = Robot::Verification::SourceDestBeds.new.layout_data_object(picking_data) @file_content = Robot::Generator::Tecan.new(picking_data: picking_data, layout: layout, total_volume: 0).as_text end |
#message ⇒ Object
88 89 90 |
# File 'app/models/stock_stamper.rb', line 88 def @message ||= {} end |
#wells_with_excess ⇒ Object
92 93 94 |
# File 'app/models/stock_stamper.rb', line 92 def wells_with_excess @wells_with_excess ||= [] end |