Class: Pooling::TagClashReport

Inherits:
SimpleDelegator
  • Object
show all
Includes:
SampleManifestExcel::Tags::ClashesFinder
Defined in:
app/models/pooling/tag_clash_report.rb

Overview

Handles the generation of user-friendly summaries of tag-clashes on the custom poolings page (PoolingsController#new) in accordance with story gpl021 Wraps the Pooling object itself

Defined Under Namespace

Classes: Clash, ClashInfo

Constant Summary collapse

UNTAGGED =
'-'

Instance Method Summary collapse

Methods included from SampleManifestExcel::Tags::ClashesFinder

#create_tags_clashes_message, #find_tags_clash

Instance Method Details

#clashesObject



22
23
24
25
26
27
28
29
30
31
# File 'app/models/pooling/tag_clash_report.rb', line 22

def clashes
  duplicates.map do |unique_key, clashes|
    Clash.new(
      unique_key[0] || UNTAGGED,
      unique_key[1] || UNTAGGED,
      unique_key[2],
      clashes.map { |clashed_aliquot| clash_info(clashed_aliquot) }
    )
  end
end

#duplicatesObject



18
19
20
# File 'app/models/pooling/tag_clash_report.rb', line 18

def duplicates
  @duplicates ||= grouped_aliquots.select { |_unique_key, aliquot_group| aliquot_group.length > 1 }
end

#tag_clash?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/pooling/tag_clash_report.rb', line 14

def tag_clash?
  duplicates.present?
end