Browse Source

Add mini profiler (#2513)

pull/2515/head
kosiakkatrina 5 months ago committed by GitHub
parent
commit
c19291c948
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      Gemfile
  2. 5
      app/controllers/lettings_logs_controller.rb

2
Gemfile

@ -63,6 +63,7 @@ gem "possessive"
gem "auto_strip_attributes" gem "auto_strip_attributes"
# Use sidekiq for background processing # Use sidekiq for background processing
gem "method_source", "~> 1.1" gem "method_source", "~> 1.1"
gem "rack-mini-profiler", "~> 2.0"
gem "rails_admin", "~> 3.1" gem "rails_admin", "~> 3.1"
gem "ruby-openai" gem "ruby-openai"
gem "sidekiq" gem "sidekiq"
@ -90,7 +91,6 @@ group :development do
# Display performance information such as SQL time and flame graphs for each request in your browser. # Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem "erb_lint", require: false gem "erb_lint", require: false
gem "rack-mini-profiler", "~> 2.0"
gem "rubocop-govuk", "4.3.0", require: false gem "rubocop-govuk", "4.3.0", require: false
gem "rubocop-performance", require: false gem "rubocop-performance", require: false
gem "rubocop-rails", require: false gem "rubocop-rails", require: false

5
app/controllers/lettings_logs_controller.rb

@ -11,6 +11,11 @@ class LettingsLogsController < LogsController
before_action :extract_bulk_upload_from_session_filters, only: [:index] before_action :extract_bulk_upload_from_session_filters, only: [:index]
before_action :redirect_if_bulk_upload_resolved, only: [:index] before_action :redirect_if_bulk_upload_resolved, only: [:index]
before_action do
if current_user && current_user.support?
Rack::MiniProfiler.authorize_request
end
end
def index def index
all_logs = current_user.lettings_logs.visible.filter_by_years_or_nil(FormHandler.instance.years_of_available_lettings_forms) all_logs = current_user.lettings_logs.visible.filter_by_years_or_nil(FormHandler.instance.years_of_available_lettings_forms)

Loading…
Cancel
Save