Skip to content

Commit

Permalink
remove no longer used benchmark code. #224
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 9, 2019
1 parent 87e0906 commit 7489629
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
34 changes: 14 additions & 20 deletions app/controllers/concerns/facetable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,20 @@ def prefixes_totals(arr)
def clients_totals(arr)
logger = Logger.new(STDOUT)

clients = nil
logger.info "[Benchmark] clients_totals find_by_ids " + Benchmark.ms {
clients = Client.all.pluck(:symbol, :name).to_h
}.to_s + " ms"

logger.info "[Benchmark] clients_totals map " + Benchmark.ms {
arr = arr.map do |hsh|
{ "id" => hsh["key"],
"title" => clients[hsh["key"].upcase],
"count" => hsh["doc_count"],
"temporal" => {
"this_month" => facet_anual(hsh.this_month.buckets),
"this_year" => facet_anual(hsh.this_year.buckets),
"last_year" => facet_anual(hsh.last_year.buckets)
},
"states" => facet_by_key(hsh.states.buckets)
}
end
}.to_s + " ms"
arr
clients = Client.all.pluck(:symbol, :name).to_h

arr = arr.map do |hsh|
{ "id" => hsh["key"],
"title" => clients[hsh["key"].upcase],
"count" => hsh["doc_count"],
"temporal" => {
"this_month" => facet_anual(hsh.this_month.buckets),
"this_year" => facet_anual(hsh.this_year.buckets),
"last_year" => facet_anual(hsh.last_year.buckets)
},
"states" => facet_by_key(hsh.states.buckets)
}
end
end

def facet_by_provider_ids(arr)
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ def index
total = sample_dois.length
total_pages = 1
else
results = nil
logger.info "[Benchmark] results " + Benchmark.ms {
results = response.results
}.to_s + " ms"
results = response.results
total = response.results.total
total_for_pages = page[:cursor].present? ? total.to_f : [total.to_f, 10000].min
total_pages = page[:size] > 0 ? (total_for_pages / page[:size]).ceil : 0
Expand Down

0 comments on commit 7489629

Please sign in to comment.