Skip to content

Commit

Permalink
fix query parameters for graphql connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 11, 2020
1 parent 06c2282 commit 217e64a
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/graphql/types/data_catalog_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def software_application
end

def datasets(**args)
Doi.query(args[:query], re3data_id: object[:id], user_id: args[:user_id], client_id: args[:repository_id], member_id: args[:member_id], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], resource_type_id: "Dataset", state: "findable", page: { number: 1, size: args[:first] }).results.to_a
Doi.query(args[:query], re3data_id: object[:id], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], resource_type_id: "Dataset", state: "findable", page: { number: 1, size: args[:first] }).results.to_a
end

def view_count
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/doi_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def version_of(**args)
def response(**args)
return [] if args[:ids].blank?

Doi.query(args[:query], ids: args[:ids], funder_id: args[:funder_id], user_id: args[:user_id], repository_id: args[:repository_id], member_id: args[:member_id], affiliation_id: args[:affiliation_id], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] }).results.to_a
Doi.query(args[:query], ids: args[:ids], funder_id: args[:funder_id], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] }).results.to_a
end

def doi_link(url)
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/funder_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ def citation_count
end

def response(**args)
Doi.query(args[:query], funder_id: object[:id], user_id: args[:user_id], repository_id: args[:repository_id], member_id: args[:member_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], funder_id: object[:id], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/member_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,6 @@ def citation_count
end

def response(**args)
Doi.query(args[:query], user_id: args[:user_id], repository_id: args[:repository_id], provider_id: object.uid, funder_id: args[:funder_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_funder: args[:has_funder], has_affiliation: args[:has_affiliation], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], user_id: args[:user_id], client_id: args[:repository_id], provider_id: object.uid, funder_id: args[:funder_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_funder: args[:has_funder], has_affiliation: args[:has_affiliation], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/organization_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ def citation_count
end

def response(**args)
Doi.query(args[:query], affiliation_id: object[:id], user_id: args[:user_id], repository_id: args[:repository_id], member_id: args[:member_id], funder_id: args[:funder_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_funder: args[:has_funder], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], affiliation_id: object[:id], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], funder_id: args[:funder_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_funder: args[:has_funder], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/person_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ def citation_count
end

def response(**args)
Doi.query(args[:query], user_id: object[:id], repository_id: args[:repository_id], member_id: args[:member_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_funder: args[:has_funder], has_affiliation: args[:has_affiliation], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], user_id: object[:id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_funder: args[:has_funder], has_affiliation: args[:has_affiliation], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/query_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def usage_report(id:)
end

def response(**args)
@response ||= Doi.query(args[:query], ids: args[:ids], user_id: args[:user_id], repository_id: args[:repository_id], member_id: args[:member_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] }).results.to_a
@response ||= Doi.query(args[:query], ids: args[:ids], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] }).results.to_a
end

def set_doi(id)
Expand Down
8 changes: 4 additions & 4 deletions app/graphql/types/repository_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,22 @@ def prefixes(**args)
def view_count
args = { first: 0 }
r = response(args)
r.results.total.positive? ? aggregate_count(r.response.aggregations.views.buckets) : []
r.results.total.positive? ? aggregate_count(r.response.aggregations.views.buckets) : 0
end

def download_count
args = { first: 0 }
r = response(args)
r.results.total.positive? ? aggregate_count(r.response.aggregations.downloads.buckets) : []
r.results.total.positive? ? aggregate_count(r.response.aggregations.downloads.buckets) : 0
end

def citation_count
args = { first: 0 }
r = response(args)
r.results.total.positive? ? aggregate_count(r.response.aggregations.citations.buckets) : []
r.results.total.positive? ? aggregate_count(r.response.aggregations.citations.buckets) : 0
end

def response(**args)
Doi.query(args[:query], funder_id: args[:funder_id], user_id: args[:user_id], repository_id: object.uid, member_id: args[:member_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_organization: args[:has_organization], has_funder: args[:has_funder], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], funder_id: args[:funder_id], user_id: args[:user_id], client_id: object.uid, provider_id: args[:member_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_organization: args[:has_organization], has_funder: args[:has_funder], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
end
end
4 changes: 2 additions & 2 deletions app/graphql/types/software_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def response(**args)
Doi.query(args[:query],
ids: args[:ids],
user_id: args[:user_id],
repository_id: args[:repository_id],
member_id: args[:member_id],
client_id: args[:repository_id],
provider_id: args[:member_id],
funder_id: args[:funder_id],
affiliation_id: args[:affiliation_id],
re3data_id: args[:re3data_id],
Expand Down
4 changes: 2 additions & 2 deletions app/graphql/types/sound_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def response(**args)
Doi.query(args[:query],
ids: args[:ids],
user_id: args[:user_id],
repository_id: args[:repository_id],
member_id: args[:member_id],
client_id: args[:repository_id],
provider_id: args[:member_id],
funder_id: args[:funder_id],
affiliation_id: args[:affiliation_id],
re3data_id: args[:re3data_id],
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/work_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def response(**args)
ids: args[:ids],
user_id: args[:user_id],
client_id: args[:repository_id],
member_id: args[:member_id],
provider_id: args[:member_id],
funder_id: args[:funder_id],
affiliation_id: args[:affiliation_id],
re3data_id: args[:re3data_id],
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/workflow_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def response(**args)
ids: args[:ids],
user_id: args[:user_id],
client_id: args[:repository_id],
member_id: args[:member_id],
provider_id: args[:member_id],
funder_id: args[:funder_id],
affiliation_id: args[:affiliation_id],
re3data_id: args[:re3data_id],
Expand Down

0 comments on commit 217e64a

Please sign in to comment.