Skip to content

Commit

Permalink
correctly show all activities per doi. #216
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Mar 10, 2019
1 parent 9737fec commit 89ddadc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ActivitiesController < ApplicationController
include Countable

before_action :set_doi
before_action :set_activity, only: [:show]
before_action :set_include

Expand All @@ -20,7 +19,7 @@ def index
elsif params[:ids].present?
response = Activity.find_by_ids(params[:ids], page: page, sort: sort)
else
response = Activity.query(params[:query], page: page, sort: sort)
response = Activity.query(params[:query], uid: params[:doi_id], page: page, sort: sort)
end

begin
Expand Down Expand Up @@ -78,10 +77,6 @@ def set_include
end
end

def set_doi
@doi = Doi.where(doi: params[:doi_id]).first
end

def set_activity
@activity = Activity.where(request_uuid: params[:id]).first
fail ActiveRecord::RecordNotFound unless @activity.present?
Expand Down
1 change: 1 addition & 0 deletions app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def query(query, options={})
must << { terms: { provider_id: options[:provider_id].split(",") }} if options[:provider_id].present?
must << { terms: { client_id: options[:client_id].to_s.split(",") }} if options[:client_id].present?
must << { term: { prefix: options[:prefix] }} if options[:prefix].present?
must << { term: { uid: options[:uid] }} if options[:uid].present?
must << { term: { "author.id" => "https://orcid.org/#{options[:person_id]}" }} if options[:person_id].present?
must << { range: { created: { gte: "#{options[:created].split(",").min}||/y", lte: "#{options[:created].split(",").max}||/y", format: "yyyy" }}} if options[:created].present?
must << { term: { schema_version: "http://datacite.org/schema/kernel-#{options[:schema_version]}" }} if options[:schema_version].present?
Expand Down

0 comments on commit 89ddadc

Please sign in to comment.