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

fix(flags/tagsDrawer): ensure distribution percentages add to 100 #87308

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

aliu39
Copy link
Member

@aliu39 aliu39 commented Mar 18, 2025

Use Math.round for percents and calculate otherPercentage by subtracting from 100. Non-zero percents that are rounded to 0 are displayed as "<1%".

Sample issue
Closes https://github.com/getsentry/team-replay/issues/562

After
SCR-20250318-kreo

Before
SCR-20250318-kqjg

Edge cases
totalValues 1000, topValues 500, 490, 5, 5
totalValues 1000, topValues 500, 490, 4, 3, 3
totalValues 1000, topValues 500, 490, 15, 5
Screenshot 2025-03-18 at 11 57 05 AM

0% are never shown for top values or other

@aliu39 aliu39 requested a review from a team as a code owner March 18, 2025 18:49
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 18, 2025
@aliu39 aliu39 requested a review from a team March 18, 2025 18:49
Copy link
Member

@roggenkemper roggenkemper left a comment

Choose a reason for hiding this comment

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

if we're going to make any updates here, can we make sure that the changes are made everywhere (preview, details, drawer)

@aliu39 aliu39 changed the title ref(flags/tagsDrawer): ensure distribution percentages add to 100 fix(flags/tagsDrawer): ensure distribution percentages add to 100 Mar 18, 2025
@aliu39
Copy link
Member Author

aliu39 commented Mar 18, 2025

I can probably make some/all of the edge case screenshots into jest tests, will add within the next day

Copy link

codecov bot commented Mar 18, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
9955 1 9954 4
View the top 1 failed test(s) by shortest run time
TagDetailsDrawerContent renders a list of tag values
Stack Traces | 0.095s run time
TestingLibraryElementError: Unable to find an element with the text: 16%. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
...
    at Object.getElementError (.../sentry/sentry/node_modules/@.../dom/dist/config.js:37:19)
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:76:38
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:52:17
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:95:19
    at Object.<anonymous> (.../issueDetails/groupTags/tagDetailsDrawerContent.spec.tsx:80:40)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants