Skip to content

Commit

Permalink
Dont set the put_code if we didn't get it back.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Oct 22, 2021
1 parent 242ba33 commit d9bfe4d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/models/claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,16 @@ def process_data(options = {})
notify
else
if to_be_created?
update_columns(claimed_at: Time.zone.now,
put_code: result.body["put_code"],
error_messages: [])
to_update = {
:claimed_at => Time.zone.now,
:error_messages => []
}

if result.body["put_code"].present?
to_update[:put_code] = result.body["put_code"]
end

update_columns(to_update)

logger.info "[Done] #{uid}#{doi} with Put Code #{result.body['put_code']}"
elsif to_be_deleted?
Expand Down

0 comments on commit d9bfe4d

Please sign in to comment.