use eager loading to reduce the number of database queries
This commit is contained in:
@ -34,7 +34,7 @@ class ExecutionEnvironmentsController < ApplicationController
|
|||||||
private :execution_environment_params
|
private :execution_environment_params
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@execution_environments = ExecutionEnvironment.all.order(:name)
|
@execution_environments = ExecutionEnvironment.all.includes(:user).order(:name)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class ExercisesController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@search = policy_scope(Exercise).search(params[:q])
|
@search = policy_scope(Exercise).search(params[:q])
|
||||||
@exercises = @search.result.order(:title)
|
@exercises = @search.result.includes(:execution_environment, :user).order(:title)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ class ExternalUsersController < ApplicationController
|
|||||||
private :authorize!
|
private :authorize!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@users = ExternalUser.all
|
@users = ExternalUser.all.includes(:consumer)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class FileTypesController < ApplicationController
|
|||||||
private :file_type_params
|
private :file_type_params
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@file_types = FileType.all.order(:name)
|
@file_types = FileType.all.includes(:user).order(:name)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class InternalUsersController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@search = InternalUser.search(params[:q])
|
@search = InternalUser.search(params[:q])
|
||||||
@users = @search.result.order(:name)
|
@users = @search.result.includes(:consumer).order(:name)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class SubmissionsController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@search = Submission.search(params[:q])
|
@search = Submission.search(params[:q])
|
||||||
@submissions = @search.result.paginate(page: params[:page])
|
@submissions = @search.result.includes(:exercise, :user).paginate(page: params[:page])
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class TeamsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@teams = Team.all.order(:name)
|
@teams = Team.all.includes(:internal_users).order(:name)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user