Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Apr 12, 2019
1 parent 9234064 commit 1d973ba
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ def index
format.any(:bibtex, :citeproc, :codemeta, :crosscite, :datacite, :datacite_json, :jats, :ris, :csv, :schema_org) { render request.format.to_sym => response.records.to_a }
end
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception
Raven.capture_exception(exception)

message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason")

render json: { "errors" => { "title" => message }}.to_json, status: :bad_request
Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def query(query, options={})
from = 0
search_after = [options.dig(:page, :cursor)]
sort = [{ _id: { order: 'asc' }}]
elsif self.name == "Activity" && options.dig(:page, :cursor).present?
from = 0
search_after = [options.dig(:page, :cursor)]
sort = [{ created: { order: 'asc' }}]
else
from = (options.dig(:page, :number) - 1) * options.dig(:page, :size)
search_after = nil
Expand Down
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Application < Rails::Application
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
config.log_level = ENV['LOG_LEVEL'].to_sym

# configure caching
config.cache_store = :dalli_store, nil, { :namespace => ENV['APPLICATION'] }
Expand Down
1 change: 0 additions & 1 deletion config/initializers/lograge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
event.payload.inspect.length > 100000
end
config.lograge.base_controller_class = 'ActionController::API'
config.log_level = ENV['LOG_LEVEL'].to_sym

config.lograge.custom_options = lambda do |event|
exceptions = %w(controller action format id)
Expand Down

0 comments on commit 1d973ba

Please sign in to comment.