Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Nov 26, 2020
2 parents c43c094 + 4f73d48 commit 5c9de77
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/models/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ def transfer(provider_target_id: nil)
return nil
end

Rails.logger.info "[Transfer] Client transfer starting from #{provider_id} to #{target_provider.id}"

# Transfer client
update_attribute(:allocator, target_provider.id)

Expand All @@ -535,11 +537,8 @@ def transfer_prefixes(provider_target_id: nil)
prefixes_names = associated_prefixes.pluck(:uid)

if prefix_ids.present?
response =
ProviderPrefix.where("prefix_id IN (?)", prefix_ids).destroy_all
Rails.logger.info "[Transfer] #{
response.count
} provider prefixes deleted."
response = ProviderPrefix.where("prefix_id IN (?)", prefix_ids).destroy_all
Rails.logger.info "[Transfer][Prefix] #{response.count} provider prefixes deleted. #{prefix_ids}"
end

# Assign prefix(es) to provider and client
Expand All @@ -548,7 +547,7 @@ def transfer_prefixes(provider_target_id: nil)
ProviderPrefix.create(
provider_id: provider_target_id, prefix_id: prefix,
)
Rails.logger.info "[Transfer] Provider prefix for provider #{
Rails.logger.info "[Transfer][Prefix] Provider prefix for provider #{
provider_target_id
} and prefix #{prefix} created."

Expand All @@ -557,7 +556,7 @@ def transfer_prefixes(provider_target_id: nil)
provider_prefix_id: provider_prefix.uid,
prefix_id: prefix,
)
Rails.logger.info "Client prefix for client #{symbol} and prefix #{
Rails.logger.info "[Transfer][Prefix] Client prefix for client #{symbol} and prefix #{
prefix
} created."
end
Expand Down

0 comments on commit 5c9de77

Please sign in to comment.