From 189175706123682736392331985818703e7af32b Mon Sep 17 00:00:00 2001 From: kjgarza Date: Mon, 27 Sep 2021 17:12:35 +0200 Subject: [PATCH 1/2] added missing aggregation in model --- app/models/doi.rb | 1 + spec/graphql/types/work_type_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/app/models/doi.rb b/app/models/doi.rb index 023dd6eb0..8c55b9760 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -588,6 +588,7 @@ def self.gql_query_aggregations(facet_count: 10) if facet_count.positive? { resource_types: { terms: { field: "resource_type_id_and_name", size: facet_count, min_doc_count: 1 } }, + clients: { terms: { field: "client_id_and_name", size: facet_count, min_doc_count: 1 } }, open_licenses: { filter: { terms: { "rights_list.rightsIdentifier": ["cc-by-1.0", "cc-by-2.0", "cc-by-2.5", "cc-by-3.0", "cc-by-3.0-at", "cc-by-3.0-us", "cc-by-4.0", "cc-pddc", "cc0-1.0", "cc-pdm-1.0"] } }, aggs: { diff --git a/spec/graphql/types/work_type_spec.rb b/spec/graphql/types/work_type_spec.rb index 48aeae609..088022b0c 100644 --- a/spec/graphql/types/work_type_spec.rb +++ b/spec/graphql/types/work_type_spec.rb @@ -592,6 +592,11 @@ title count } + repositories { + id + title + count + } languages { id title @@ -646,6 +651,9 @@ expect(response.dig("data", "works", "registrationAgencies")).to eq( [{ "count" => 10, "id" => "datacite", "title" => "DataCite" }], ) + expect(response.dig("data", "works", "repositories").first).to eq( + { "count" => 1, "id" => "testa.test1", "title" => "My data center" }, + ) expect(response.dig("data", "works", "languages")).to eq( [{ "count" => 10, "id" => "nl", "title" => "Dutch" }], ) From d73d9dcd14242d0596a5773676a707cd3958c230 Mon Sep 17 00:00:00 2001 From: kjgarza Date: Mon, 27 Sep 2021 17:27:41 +0200 Subject: [PATCH 2/2] account for existing test data --- spec/graphql/types/work_type_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/graphql/types/work_type_spec.rb b/spec/graphql/types/work_type_spec.rb index 088022b0c..3e33bb239 100644 --- a/spec/graphql/types/work_type_spec.rb +++ b/spec/graphql/types/work_type_spec.rb @@ -651,8 +651,8 @@ expect(response.dig("data", "works", "registrationAgencies")).to eq( [{ "count" => 10, "id" => "datacite", "title" => "DataCite" }], ) - expect(response.dig("data", "works", "repositories").first).to eq( - { "count" => 1, "id" => "testa.test1", "title" => "My data center" }, + expect(response.dig("data", "works", "repositories").first["title"]).to eq( + "My data center" ) expect(response.dig("data", "works", "languages")).to eq( [{ "count" => 10, "id" => "nl", "title" => "Dutch" }],