Skip to content

Commit

Permalink
remove unneeded code. datacite/datacite#359
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Nov 21, 2019
1 parent 1ad60af commit e395caf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
5 changes: 2 additions & 3 deletions app/controllers/clients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ def totals
page = { size: 0, number: 1 }
state = current_user.present? && current_user.is_admin_or_staff? && params[:state].present? ? params[:state] : "registered,findable"
response = Doi.query(nil, provider_id: params[:provider_id], state: state, page: page, totals_agg: true)
total = response.results.total

registrant = total > 0 ? clients_totals(response.response.aggregations.clients_totals.buckets) : nil
registrant = clients_totals(response.response.aggregations.clients_totals.buckets)

render json: registrant, status: :ok
end

Expand Down
5 changes: 2 additions & 3 deletions app/controllers/prefixes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ def update
def totals
page = { size: 0, number: 1}
response = Doi.query(nil, client_id: params[:client_id], state: "findable,registered", page: page, totals_agg: true)
total = response.results.total

registrant = total > 0 ? prefixes_totals(response.response.aggregations.prefixes_totals.buckets) : nil
registrant = prefixes_totals(response.response.aggregations.prefixes_totals.buckets)

render json: registrant, status: :ok
end

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ def totals

state = current_user.present? && current_user.is_admin_or_staff? && params[:state].present? ? params[:state] : "registered,findable"
response = Doi.query(nil, state: state, page: page, totals_agg: true)
total = response.results.total
registrant = total > 0 ? providers_totals(response.response.aggregations.providers_totals.buckets) : nil
registrant = providers_totals(response.response.aggregations.providers_totals.buckets)

render json: registrant, status: :ok
end
Expand Down
5 changes: 2 additions & 3 deletions app/controllers/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ def totals

state = current_user.present? && current_user.is_admin_or_staff? && params[:state].present? ? params[:state] : "registered,findable"
response = Doi.query(nil, provider_id: params[:provider_id], state: state, page: page, totals_agg: true)
total = response.results.total

registrant = total > 0 ? clients_totals(response.response.aggregations.clients_totals.buckets) : nil
registrant = clients_totals(response.response.aggregations.clients_totals.buckets)

render json: registrant, status: :ok
end

Expand Down

0 comments on commit e395caf

Please sign in to comment.