Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Group samples count calculation should include shared groups and projects #862

Merged
merged 31 commits into from
Jan 8, 2025

Conversation

malchua
Copy link
Contributor

@malchua malchua commented Dec 6, 2024

What does this PR do and why?

Describe in detail what your merge request does and why.
This PR changes the sample count of a group to incorporate sample counts from it's shared groups and projects. This update will allow the samples count to properly reflect the amount of samples shown after clicking samples on the sidebar for a group.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.
General check:

  1. Click on Groups in the sidebar.
  2. Take note of the samples count for any group that you know has a group or project shared with it. Click on that group.
  3. Click on Samples in the sidebar.
  4. At the bottom of the page, there is a section saying "Display 1-20 of X items" where X is the total number of samples this group has access to. Confirm that this number equals the one noted in step 2.

Sharing a project:

  1. Click on Groups in the sidebar.
  2. Take note of the samples count for any group that you have access to.
  3. Click on Projects in the sidebar.
  4. Select a project that you own, that has not already been shared to the group in step 2.
  5. Click on Members in the sidebar.
  6. Select the "Invite group" button.
  7. Select the group that was noted in step 2, and give it an access level of Analyst. Click "Share".
  8. Repeat the general check above with the group selected in step 2. The samples count should have increase by the direct samples count** of the project we shared.

Sharing a group:

  1. Click on Groups in the sidebar.
  2. Take note of the samples count for any group that you have access to.
  3. Select a different group that you have access to and want to share with the group in step 2. This different group should not already be shared with the group in step 2.
  4. Click on Members in the sidebar.
  5. Select the "Invite group" button.
  6. Select the group that was noted in step 2, and give it an access level of Analyst. Click "Share".
  7. Repeat the general check above with the group selected in step 2. The samples count should have increase by the direct samples count** of the group we shared.

**Direct samples count for a shared project = samples count of that project
**Direct samples count for a shared group = the sum of all samples found within projects in itself and it's ancestor groups. (This does not include the samples count of projects or groups that have been shared with it)

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@malchua malchua force-pushed the group/total-samples branch from 201b69c to b597634 Compare December 18, 2024 19:09

This comment has been minimized.

@malchua malchua marked this pull request as ready for review December 18, 2024 19:50
@malchua malchua added the ready for review Pull request is ready for review label Dec 18, 2024
Copy link
Member

@JeffreyThiessen JeffreyThiessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and is working as specified. Just one small change.

This comment has been minimized.

Copy link
Member

@JeffreyThiessen JeffreyThiessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

Copy link
Member

@ericenns ericenns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, just one small comment.

Can you change line 15 in app/controllers/groups/samples_controller.rb to use aggregated_samples_count instead of the query it is currently doing.

@malchua
Copy link
Contributor Author

malchua commented Jan 3, 2025

This is looking great, just one small comment.

Can you change line 15 in app/controllers/groups/samples_controller.rb to use aggregated_samples_count instead of the query it is currently doing.

Changed in bcc3fed

This comment has been minimized.

@malchua malchua force-pushed the group/total-samples branch from d29b696 to cba4420 Compare January 7, 2025 04:32
ericenns
ericenns previously approved these changes Jan 7, 2025
Copy link
Member

@ericenns ericenns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment, but also could you review and fix the rubocop warnings in app/models/group.rb

@ericenns ericenns dismissed their stale review January 7, 2025 14:28

Mean't to request changes

@malchua malchua force-pushed the group/total-samples branch from cba4420 to 19c1044 Compare January 8, 2025 02:17
@malchua malchua force-pushed the group/total-samples branch from 643a741 to 50a9866 Compare January 8, 2025 02:51

This comment has been minimized.

Copy link
Member

@ericenns ericenns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, just only one minor comment and then this can be merged in.

Copy link

github-actions bot commented Jan 8, 2025

Code Metrics Report

Coverage Test Execution Time
92.9% 10m20s

Code coverage of files in pull request scope (99.3%)

Files Coverage
app/components/namespace_tree/row/row_contents_component.html.erb 100.0%
app/controllers/groups/samples_controller.rb 98.0%
app/models/group.rb 100.0%

Reported by octocov

Copy link
Member

@ericenns ericenns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@ericenns ericenns merged commit ae1712b into main Jan 8, 2025
4 checks passed
@ericenns ericenns deleted the group/total-samples branch January 8, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review Pull request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants