Skip to content

Commit

Permalink
chore: refactor group samples table to resolve rubocop warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ericenns committed Dec 12, 2024
1 parent 2929154 commit 5fccc46
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/controllers/groups/samples_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def group
@group = Group.find_by_full_path(params[:group_id]) # rubocop:disable Rails/DynamicFindBy
end

def authorized_projects
authorized_scope(Project, type: :relation, as: :group_projects, scope_options: { group: @group })
end

def authorized_samples
authorized_scope(Sample, type: :relation, as: :namespace_samples,
scope_options: { namespace: @group }).includes(project: { namespace: [{ parent: :route },
Expand Down Expand Up @@ -82,7 +78,10 @@ def query
@search_params = search_params
set_metadata_fields

@query = Sample::Query.new(@search_params.except(:metadata).merge({ project_ids: authorized_projects.select(:id).pluck(:id) }))
project_ids =
authorized_scope(Project, type: :relation, as: :group_projects, scope_options: { group: @group }).pluck(:id)

@query = Sample::Query.new(@search_params.except(:metadata).merge({ project_ids: project_ids }))
end

def search_params
Expand Down

0 comments on commit 5fccc46

Please sign in to comment.