Skip to content

Commit

Permalink
prevent records with an empty :validation_status_for_aapb (including …
Browse files Browse the repository at this point in the history
…all non-Assets) from raising Push validation errors
  • Loading branch information
bkiahstroud committed Jul 15, 2023
1 parent 012febe commit 954caed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def validate_status

def add_status_error(invalid_docs, status)
ids_matching_status = invalid_docs.select { |doc| doc.validation_status_for_aapb.include?(status) }.map(&:id)
# Prevents adding errors to docs that don't have a value
# in :validation_status_for_aapb, including all non-Assets.
return if ids_matching_status.blank?

errors.add(:pushed_id_csv, "The following IDs are #{status}: #{ids_matching_status.join(', ')}")
end

Expand Down

0 comments on commit 954caed

Please sign in to comment.