diff --git a/app/models/samples_report.rb b/app/models/samples_report.rb index d3c01ed8c..846e6767b 100644 --- a/app/models/samples_report.rb +++ b/app/models/samples_report.rb @@ -76,7 +76,8 @@ def calculate_lod_and_lob # Returns any sample that isn't a distractor. def target_sample - samples.where.not(distractor: true).take! + target_sample = samples.find_by("distractor IS NULL or distractor = ?", false) + target_sample ||= samples.take end private