From 5325753bb0d64f6b0ddb08c7d0938639b652d5d0 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Wed, 25 Nov 2020 11:02:22 +0100 Subject: [PATCH] Add more logging for client transfer --- app/models/client.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/client.rb b/app/models/client.rb index 53ddd548c..fe5c80e35 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -349,6 +349,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) @@ -371,16 +373,16 @@ def transfer_prefixes(provider_target_id: nil) if prefix_ids.present? response = ProviderPrefix.where("prefix_id IN (?)", prefix_ids).destroy_all - Rails.logger.info "[Transfer] #{response.count} provider prefixes deleted." + Rails.logger.info "[Transfer][Prefix] #{response.count} provider prefixes deleted. #{prefix_ids}" end # Assign prefix(es) to provider and client prefixes_names.each do |prefix| provider_prefix = ProviderPrefix.create(provider_id: provider_target_id, prefix_id: prefix) - Rails.logger.info "[Transfer] Provider prefix for provider #{provider_target_id} and prefix #{prefix} created." + Rails.logger.info "[Transfer][Prefix] Provider prefix for provider #{provider_target_id} and prefix #{prefix} created." ClientPrefix.create(client_id: symbol, provider_prefix_id: provider_prefix.uid, prefix_id: prefix) - Rails.logger.info "Client prefix for client #{symbol} and prefix #{prefix} created." + Rails.logger.info "[Transfer][Prefix] Client prefix for client #{symbol} and prefix #{prefix} created." end end @@ -494,7 +496,7 @@ def self.export_doi_counts(query: nil) name = +client.name.truncate(80) # Clean the name to remove quotes, which can break csv parsers name.gsub! /["']/, '' - + row = { accountName: name, fabricaAccountId: client.symbol,