diff --git a/app/graphql/types/person_type.rb b/app/graphql/types/person_type.rb index a61820a42..8b9bcf7bb 100644 --- a/app/graphql/types/person_type.rb +++ b/app/graphql/types/person_type.rb @@ -182,20 +182,20 @@ def works(**args) def view_count args = { first: 0 } - r = response(args) - r.response.aggregations.view_count.value.to_i + @r = response(args) if @r.nil? + @r.response.aggregations.view_count.value.to_i end def download_count args = { first: 0 } - r = response(args) - r.response.aggregations.download_count.value.to_i + @r = response(args) if @r.nil? + @r.response.aggregations.download_count.value.to_i end def citation_count args = { first: 0 } - r = response(args) - r.response.aggregations.citation_count.value.to_i + @r = response(args) if @r.nil? + @r.response.aggregations.citation_count.value.to_i end def response(**args) diff --git a/db/seeds/development/base.seeds.rb b/db/seeds/development/base.seeds.rb index fa545f939..b50cc1fd5 100644 --- a/db/seeds/development/base.seeds.rb +++ b/db/seeds/development/base.seeds.rb @@ -21,7 +21,7 @@ :client, provider: provider, symbol: ENV["MDS_USERNAME"], - password: ENV["MDS_PASSWORD"], + password_input: ENV["MDS_PASSWORD"], ) if Prefix.where(uid: "10.14454").blank? prefix = FactoryBot.create(:prefix, uid: "10.14454") diff --git a/lib/tasks/elasticsearch.rake b/lib/tasks/elasticsearch.rake index d8cfda6ef..1ac8ec86f 100644 --- a/lib/tasks/elasticsearch.rake +++ b/lib/tasks/elasticsearch.rake @@ -8,12 +8,29 @@ namespace :elasticsearch do fail "These tasks can only be used in the development enviroment" if Rails.env.production? Rake::Task["provider:create_index"].invoke + Rake::Task["provider:create_alias"].invoke + Rake::Task["client:create_index"].invoke + Rake::Task["client:create_alias"].invoke + Rake::Task["prefix:create_index"].invoke + Rake::Task["prefix:create_alias"].invoke + Rake::Task["provider_prefix:create_index"].invoke + Rake::Task["provider_prefix:create_alias"].invoke + Rake::Task["client_prefix:create_index"].invoke - Rake::Task["doi:create_index"].invoke + Rake::Task["client_prefix:create_alias"].invoke + + Rake::Task["other_doi:create_index"].invoke + Rake::Task["other_doi:create_alias"].invoke + + Rake::Task["datacite_doi:create_index"].invoke + Rake::Task["datacite_doi:create_alias"].invoke + Rake::Task["event:create_index"].invoke + Rake::Task["event:create_alias"].invoke + Rake::Task["activity:create_index"].invoke end @@ -26,6 +43,8 @@ namespace :elasticsearch do Rake::Task["prefix:delete_index"].invoke Rake::Task["provider_prefix:delete_index"].invoke Rake::Task["client_prefix:delete_index"].invoke + Rake::Task["other_doi:delete_index"].invoke + Rake::Task["datacite_doi:delete_index"].invoke Rake::Task["doi:delete_index"].invoke Rake::Task["event:delete_index"].invoke Rake::Task["activity:delete_index"].invoke