Skip to content

Commit

Permalink
fix unoptimize query
Browse files Browse the repository at this point in the history
  • Loading branch information
usernaimandrey committed May 4, 2024
1 parent 7d0c001 commit 357a61e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 2 additions & 3 deletions app/controllers/web/admin/career_member_users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
class Web::Admin::CareerMemberUsersController < Web::Admin::ApplicationController
before_action only: %i[index archived finished lost] do
query = { s: 'created_at desc' }.merge(params.permit![:q] || {})
@q = Career::Member.includes(:career_step_members)
.joins(:user, :career)
@q = Career::Member.joins(:user, :career)
.merge(User.permitted)
.merge(Career.with_locale)
.ransack(query)
Expand All @@ -31,7 +30,7 @@ def index
end

def archived
scope = @career_members.includes(:versions).archived
scope = @career_members.archived

respond_to do |format|
format.html do
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/web/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ class Web::ApplicationController < ApplicationController
# end

def last_answers
@last_answers ||= Resume::Answer.web.order(id: :desc).limit(10)
@last_answers ||= Resume::Answer
.includes(%i[resume user])
.web
.order(id: :desc)
.limit(10)
end

# NOTE: https://github.com/charlotte-ruby/impressionist/pull/294
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/web/vacancy_filters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ class Web::VacancyFiltersController < Web::ApplicationController
def show
@options = fetch_options(params[:id])

scope = Vacancy.web.includes(:technologies).page(params[:page]).order(published_at: :desc)
scope = Vacancy
.web
.includes(%i[technologies taggings])
.page(params[:page])
.order(published_at: :desc)

options_for_header = {
position_level: '',
Expand Down

0 comments on commit 357a61e

Please sign in to comment.