Module: Presenters::ExtendedCsv

Extended by:
ActiveSupport::Concern
Included in:
PlatePresenter
Defined in:
app/models/concerns/presenters/extended_csv.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Instance Method Details

#each_well_transfer(offset = 0) ⇒ Object

Yields information for the show_extended.csv



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/concerns/presenters/extended_csv.rb', line 11

def each_well_transfer(offset = 0) # rubocop:todo Metrics/AbcSize
  index = 0
  transfers_for_csv[offset * 4...(offset + 1) * 4].each_with_index do |transfers_list, bed_index|
    transfers_list[:transfers].each do |transfer|
      source_well, destination_wells = transfer
      Array(destination_wells).each do |destination_well|
        yield(
          {
            index: (index += 1),
            name: "#{bed_prefix}#{(offset * 4) + bed_index + 1}",
            source_well: source_well,
            destination_well: destination_well
          }.merge(transfers_list)
        )
      end
    end
  end
end