From 189175706123682736392331985818703e7af32b Mon Sep 17 00:00:00 2001 From: kjgarza Date: Mon, 27 Sep 2021 17:12:35 +0200 Subject: [PATCH] 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" }], )