Class: QcResult

Inherits:
ApplicationRecord show all
Includes:
Api::Messages::QcResultIO::Extensions
Defined in:
app/models/qc_result.rb

Overview

QcResult QC results record any measurement, qualitative or quantitative about an asset For example, volume/concentration Assay type: The protocol/equipment used. Might also indicate the stage of the process. Assay version: Allows versioning and comparison of different protocols Value: The measurement recorded Units: eg. nM, the units in which the measurement was recorded Key: The attribute being measured. Eg. Concentration qc_assay: Groups together qc results performed at the same time.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Attribute Details

#suppress_updatesObject

Set to disable updating well_attributes


16
17
18
# File 'app/models/qc_result.rb', line 16

def suppress_updates
  @suppress_updates
end

Class Method Details

.by_keyObject


34
35
36
# File 'app/models/qc_result.rb', line 34

def self.by_key
  order_by_date.group_by { |qc_result| qc_result.key.downcase }
end

Instance Method Details

#unit_valueUnit

Returns a unit object, which allows easy conversion between different scales, as well as performing arithmetic with different measurements. Caution: Raises an exception if the units are unrecognised, or if the value is not a number


45
46
47
48
# File 'app/models/qc_result.rb', line 45

def unit_value
  # Don't cache to avoid the need to worry about cache invalidation
  Unit.new(value, units)
end

#unit_value=(unit_value) ⇒ Object


50
51
52
53
# File 'app/models/qc_result.rb', line 50

def unit_value=(unit_value)
  self.value = unit_value.scalar
  self.units = unit_value.units
end