Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions app/controllers/api/v1/stats_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class Api::V1::StatsController < ApplicationController
before_action :ensure_authenticated!, only: [ :show ], unless: -> { Rails.env.development? }
before_action :set_user, only: [ :user_stats, :user_spans, :user_projects, :user_project, :user_projects_details ]
around_action :disable_index_scans_for_stats, only: [ :show, :user_stats ]

def show
# take either user_id with a start date & end date
Expand Down Expand Up @@ -225,15 +224,6 @@ def user_projects_details

private

def disable_index_scans_for_stats
ActiveRecord::Base.connection.transaction do
ActiveRecord::Base.connection.execute("SET LOCAL enable_indexscan = off")
ActiveRecord::Base.connection.execute("SET LOCAL enable_bitmapscan = off")
ActiveRecord::Base.connection.execute("SET LOCAL enable_indexonlyscan = off")
yield
end
end

def set_user
token = request.headers["Authorization"]&.split(" ")&.last
identifier = params[:username] || params[:username_or_id] || params[:user_id]
Expand Down
Loading