From 73d274329afeef1d1c2ccf1cbb18c91d1379e0fe Mon Sep 17 00:00:00 2001 From: Meghan Chua <17057809+malchua@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:29:04 -0600 Subject: [PATCH] Refactor function to have an earlier return --- app/models/group.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/group.rb b/app/models/group.rb index 54895740bb..7c58823c93 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -92,9 +92,9 @@ def shared_namespace_metadata_keys(namespace) end def aggregated_samples_count # rubocop:disable Metrics/AbcSize - aggregated_samples_count = samples_count + return samples_count unless shared_namespaces.any? - return aggregated_samples_count unless shared_namespaces.any? + aggregated_samples_count = samples_count projects_ids = [] shared_groups.self_and_descendants.where(type: [Namespaces::ProjectNamespace.sti_name])