Class: WellAttribute

Inherits:
ApplicationRecord show all
Includes:
AASM
Defined in:
app/models/well_attribute.rb

Overview

Note:

Try and use QcResult for any future readings, it will automatically update this table for you.

Contains qc information regarding a well, in addition to volume information to assist with Cherrypicking

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 Method Details

#current_volume=(current_volume) ⇒ Object


69
70
71
72
# File 'app/models/well_attribute.rb', line 69

def current_volume=(current_volume)
  current_volume = 0.0 if current_volume.to_f < 0
  super
end

#estimated_volumeObject


47
48
49
# File 'app/models/well_attribute.rb', line 47

def estimated_volume
  (current_volume || measured_volume).try(:to_f)
end

#gender_markers_stringObject


13
14
15
# File 'app/models/well_attribute.rb', line 13

def gender_markers_string
  gender_markers.try(:to_s)
end

#initial_volume=(volume) ⇒ Object


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

def initial_volume=(volume)
  super if initial_volume.nil?
end

#measured_volume=(volume) ⇒ Object


41
42
43
44
45
# File 'app/models/well_attribute.rb', line 41

def measured_volume=(volume)
  self.initial_volume = volume
  self.current_volume = volume
  super
end

#pico_passObject

Since Pass and Fail are used as pico_state values we're forced to use a different transition name.


33
34
35
36
37
38
39
# File 'app/models/well_attribute.rb', line 33

def pico_pass
  case self[:pico_pass]
  when 'Too Low To Normalise' then 'Fail'
  when nil, '' then 'ungraded'
  else self[:pico_pass]
  end
end

#quantity_in_micro_gramsObject


62
63
64
65
66
67
# File 'app/models/well_attribute.rb', line 62

def quantity_in_micro_grams
  return nil if estimated_volume.nil? || concentration.nil?
  return 0   if estimated_volume < 0 || concentration < 0

  (estimated_volume * concentration) / 1000
end

#quantity_in_nano_gramsObject


55
56
57
58
59
60
# File 'app/models/well_attribute.rb', line 55

def quantity_in_nano_grams
  return nil if estimated_volume.nil? || concentration.nil?
  return 0   if estimated_volume < 0 || concentration < 0

  (estimated_volume * concentration).to_i
end