Class: QcMetric
Defined Under Namespace
Modules: QcState
Constant Summary
collapse
- InvalidValue =
Class.new(StandardError)
- QC_DECISION_TRANSITIONS =
{
'passed' => 'manually_passed',
'manually_passed' => 'manually_passed',
'failed' => 'manually_failed',
'manually_failed' => 'manually_failed'
}.freeze
- PROCEED_TRANSLATION =
{ true => 'Y', false => 'N' }.freeze
Instance Method Summary
collapse
Methods included from QcState
new_state, qc_state_object_called, valid_states
alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
extended
Instance Method Details
#human_proceed ⇒ Object
56
57
58
|
# File 'app/models/qc_metric.rb', line 56
def human_proceed
PROCEED_TRANSLATION[proceed]
end
|
#human_proceed=(h_proceed) ⇒ Object
60
61
62
63
64
|
# File 'app/models/qc_metric.rb', line 60
def human_proceed=(h_proceed)
return self.proceed = nil if h_proceed.blank?
self.proceed = proceedable? && human_to_bool(PROCEED_TRANSLATION, h_proceed.upcase)
end
|
#manual_qc_decision=(decision) ⇒ Object
Update the new state as appropriate: - Don’t change the state if we already match - If we have an automatic state, update to a manual state - If we already have a manual state, perform some magic to ensure eg. pass -> manual_fail -> pass BUT unprocessable -> manual_fail -> manual_pass
48
49
50
51
52
53
54
|
# File 'app/models/qc_metric.rb', line 48
def manual_qc_decision=(decision)
return if qc_decision == decision
return self.qc_decision = decision_to_manual_state(decision) if qc_automatic?
return self.qc_decision = decision if original_qc_decision == decision
self.qc_decision = decision_to_manual_state(decision)
end
|
#original_qc_decision ⇒ Object
88
89
90
|
# File 'app/models/qc_metric.rb', line 88
def original_qc_decision
qc_report.original_qc_decision(metrics)
end
|
#poor_quality_proceed ⇒ Object
The metric indicates that the sample has been progressed despite poor quality || false ensures nil gets converted to a boolean
68
69
70
|
# File 'app/models/qc_metric.rb', line 68
def poor_quality_proceed
(qc_failed? && proceed) || false
end
|
#proceedable? ⇒ Boolean
80
81
82
|
# File 'app/models/qc_metric.rb', line 80
def proceedable?
qc_state_object.proceedable
end
|
#qc_automatic? ⇒ Boolean
84
85
86
|
# File 'app/models/qc_metric.rb', line 84
def qc_automatic?
qc_state_object.automatic
end
|
#qc_failed? ⇒ Boolean
76
77
78
|
# File 'app/models/qc_metric.rb', line 76
def qc_failed?
!qc_passed?
end
|
#qc_passed? ⇒ Boolean
72
73
74
|
# File 'app/models/qc_metric.rb', line 72
def qc_passed?
qc_state_object.passed
end
|