diff --git a/app/uat_actions/uat_actions/tube_submission.rb b/app/uat_actions/uat_actions/tube_submission.rb index 190a640704..a4ec436b7f 100644 --- a/app/uat_actions/uat_actions/tube_submission.rb +++ b/app/uat_actions/uat_actions/tube_submission.rb @@ -122,6 +122,7 @@ def validate_submission_template_exists # @return [void] def validate_tubes_exist return if tube_barcodes.blank? # already validated by presence + barcodes = tube_barcodes .gsub(/(\\[trfvn])+/, ' ') @@ -130,6 +131,10 @@ def validate_tubes_exist Tube.find_by_barcode(barcode).blank? # not found end + # return if all tubes exist + return if barcodes.blank? + + # add error message listing tubes that do not exist message = format(ERROR_TUBES_DO_NOT_EXIST, barcodes.join(', ')) errors.add(:tube_barcodes, message) end