From 23857694715cc9e2329182c5deb7f9f4c50e09f5 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 7 Mar 2020 05:25:08 +0100 Subject: [PATCH 1/2] use deleted_at timestamp to set is_active --- app/controllers/export_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index 1dd512abd..d8213c8c6 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -151,7 +151,7 @@ def organizations accountName: provider.name, fabricaAccountId: provider.symbol, parentFabricaAccountId: provider.consortium.present? ? provider.consortium.symbol : nil, - isActive: provider.is_active == "\x01", + isActive: provider.deleted_at.blank?, accountDescription: provider.description, accountWebsite: provider.website, region: provider.region_human_name, @@ -257,7 +257,7 @@ def repositories accountName: name, fabricaAccountId: client.symbol, parentFabricaAccountId: client.provider.present? ? client.provider.symbol : nil, - isActive: client.is_active == "\x01", + isActive: client.deleted_at.blank? accountDescription: client.description, accountWebsite: client.url, generalContactEmail: client.system_email, From c94ba57916422d12212ec06bf6b2e7665fe248e5 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 7 Mar 2020 05:39:32 +0100 Subject: [PATCH 2/2] don't export repos with non-datacite dois --- app/models/concerns/indexable.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index 8b34f9910..c058684b2 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -233,7 +233,7 @@ def query(query, options={}) must << { term: { opendoar_id: options[:opendoar_id] }} if options[:opendoar_id].present? must << { term: { client_type: options[:client_type] }} if options[:client_type].present? must_not << { exists: { field: "deleted_at" }} unless options[:include_deleted] - must_not << { terms: { provider_id: ["crossref", "medra", "op"] }} if options[:exclude_registration_agencies] + must_not << { terms: { symbol: !%w(CROSSREF.CITATIONS MEDRA.CITATIONS JALC.CITATIONS KISTI.CITATIONS OP.CITATIONS) }} if options[:exclude_registration_agencies] elsif self.name == "Doi" must << { terms: { aasm_state: options[:state].to_s.split(",") }} if options[:state].present? must << { range: { registered: { gte: "#{options[:registered].split(",").min}||/y", lte: "#{options[:registered].split(",").max}||/y", format: "yyyy" }}} if options[:registered].present? @@ -243,7 +243,7 @@ def query(query, options={}) must << { term: { "client.re3data_id" => options[:re3data_id].gsub("/", '\/').upcase }} if options[:re3data_id].present? must << { term: { "client.opendoar_id" => options[:opendoar_id] }} if options[:opendoar_id].present? must << { terms: { "client.certificate" => options[:certificate].split(",") }} if options[:certificate].present? - must_not << { terms: { provider_id: ["crossref", "medra", "op"] }} if options[:exclude_registration_agencies] + must_not << { terms: { "client.symbol" => !%w(CROSSREF.CITATIONS MEDRA.CITATIONS JALC.CITATIONS KISTI.CITATIONS OP.CITATIONS) }} if options[:exclude_registration_agencies] elsif self.name == "Event" must << { term: { subj_id: URI.decode(options[:subj_id]) }} if options[:subj_id].present? must << { term: { obj_id: URI.decode(options[:obj_id]) }} if options[:obj_id].present?