Skip to content

Commit

Permalink
fix to validation in uat action
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsparkes committed Jan 17, 2025
1 parent 46b5a98 commit dbc8084
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/uat_actions/uat_actions/tube_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])+/, ' ')
Expand All @@ -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
Expand Down

0 comments on commit dbc8084

Please sign in to comment.