From a737669021ac34683deecda8130e21b243e14174 Mon Sep 17 00:00:00 2001 From: Eric Biagiotti Date: Wed, 27 Mar 2019 13:50:26 -0400 Subject: [PATCH] 14484: Makes quotation marks consistent Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti --- services/api/app/models/container.rb | 8 ++++---- .../20190322174136_add_file_info_to_collection.rb | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index 0e6a01c63d..694aa5a0d7 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -418,15 +418,15 @@ class Container < ArvadosModel any = true total = ActiveRecord::Base.connection.exec_query( - 'SELECT DISTINCT portable_data_hash FROM collections' + "SELECT DISTINCT portable_data_hash FROM collections" ).rows.count while any any = false pdhs_res = ActiveRecord::Base.connection.exec_query( - 'SELECT DISTINCT portable_data_hash FROM collections '\ + "SELECT DISTINCT portable_data_hash FROM collections "\ "WHERE portable_data_hash > '#{last_pdh}' "\ - 'GROUP BY portable_data_hash LIMIT 1000' + "GROUP BY portable_data_hash LIMIT 1000" ) break if pdhs_res.rows.count.zero? @@ -439,7 +439,7 @@ class Container < ArvadosModel Rails.logger.info(log_prefix + ": #{done}/#{total}") end end - Rails.logger.info(log_prefix + ': finished') + Rails.logger.info(log_prefix + ": finished") end # NOTE: Migration 20190322174136_add_file_info_to_collection.rb relies on this function. diff --git a/services/api/db/migrate/20190322174136_add_file_info_to_collection.rb b/services/api/db/migrate/20190322174136_add_file_info_to_collection.rb index a1a436ce54..c1c336247f 100755 --- a/services/api/db/migrate/20190322174136_add_file_info_to_collection.rb +++ b/services/api/db/migrate/20190322174136_add_file_info_to_collection.rb @@ -8,21 +8,21 @@ class AddFileInfoToCollection < ActiveRecord::Migration def do_batch(pdhs) pdhs_str = '' pdhs.each do |pdh| - pdhs_str << "'" << pdh << "'" << ',' + pdhs_str << "'" << pdh << "'" << "," end collections = ActiveRecord::Base.connection.exec_query( - 'SELECT DISTINCT portable_data_hash, manifest_text FROM collections '\ + "SELECT DISTINCT portable_data_hash, manifest_text FROM collections "\ "WHERE portable_data_hash IN (#{pdhs_str[0..-2]}) " ) collections.rows.each do |row| manifest = Keep::Manifest.new(row[1]) - ActiveRecord::Base.connection.exec_query('BEGIN') + ActiveRecord::Base.connection.exec_query("BEGIN") ActiveRecord::Base.connection.exec_query("UPDATE collections SET file_count=#{manifest.files_count}, "\ "file_size_total=#{manifest.files_size} "\ "WHERE portable_data_hash='#{row[0]}'") - ActiveRecord::Base.connection.exec_query('COMMIT') + ActiveRecord::Base.connection.exec_query("COMMIT") end end @@ -30,7 +30,7 @@ class AddFileInfoToCollection < ActiveRecord::Migration add_column :collections, :file_count, :integer, default: 0, null: false add_column :collections, :file_size_total, :integer, default: 0, null: false - Container.group_pdhs_for_multiple_transactions('AddFileInfoToCollection') do |pdhs| + Container.group_pdhs_for_multiple_transactions("AddFileInfoToCollection") do |pdhs| do_batch(pdhs) end end -- 2.30.2