Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Aug 7, 2019
2 parents 3004e31 + 97ea00f commit 84aa8db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def self.metrics_aggregations
filter: {script: {script: "#{INCLUDED_RELATION_TYPES}.contains(doc['relation_type_id'].value)"}
},
aggs: { dois: {
terms: { field: 'doi', size: 50, min_doc_count: 1 }, aggs: { unique_citations: { cardinality: { field: 'citation_id' }}}
terms: { field: 'doi', size: 100, min_doc_count: 1 }, aggs: { unique_citations: { cardinality: { field: 'citation_id' }}}
}}
},
views: {
Expand Down
5 changes: 2 additions & 3 deletions spec/requests/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@
context "unique citations for a list of dois" do
let!(:event) { create_list(:event_for_datacite_related, 50) }
let!(:copies) { create(:event_for_datacite_related, subj_id:"http://doi.org/10.0260/co.2004960.v1", relation_type_id: "cites") }
let(:dois) {"10.5061/dryad.47sd5e/2,10.5061/dryad.47sd5e/3,10.5061/dryad.47sd5e/4,10.0260/co.2004960.v1"}
let(:dois) { ((event.map{ |e| e['subj_id'].gsub("https://doi.org/","")})[1, 20]).join(",")}
let(:uri) { "/events?aggregations=metrics_aggregations&dois=#{dois}" }

before do
Expand All @@ -678,8 +678,7 @@
total = response.dig("meta", "total")

expect(total).to eq(51)
# TODO
# expect((citations.select { |doi| dois.split(",").include?(doi["id"]) }).length).to eq(4)
expect((citations.select { |doi| dois.split(",").include?(doi["id"]) }).length).to eq(20)
end
end

Expand Down

0 comments on commit 84aa8db

Please sign in to comment.