Module: StudyReport::AssetDetails

Included in:
Receptacle
Defined in:
app/models/study_report/asset_details.rb

Instance Method Summary collapse

Instance Method Details

#qc_reportObject

rubocop:todo Metrics/AbcSize, Metrics/MethodLength



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/study_report/asset_details.rb', line 3

def qc_report # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
  qc_data = { supplier_volume: 0 }

  sample = primary_aliquot.try(:sample)
  if sample.present?
    supplier_sample_name =
      if sample.empty_supplier_sample_name
        'Blank'
      else
        sample..supplier_name || sample.sanger_sample_id || sample.name
      end

    qc_data.merge!(
      supplier: sample.sample_manifest.try(:supplier).try(:name),
      sample_name: supplier_sample_name,
      sanger_sample_id: sample.sanger_sample_id,
      control: sample.control,
      status: (sample.updated_by_manifest ? 'Updated by manifest' : 'Awaiting manifest'),
      supplier_gender: sample..gender,
      cohort: sample..cohort,
      country_of_origin: sample..country_of_origin,
      geographical_region: sample..geographical_region,
      ethnicity: sample..ethnicity,
      dna_source: sample..dna_source,
      is_resubmitted: sample..is_resubmitted
    )
  end

  qc_data
end