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 Usage percentage display #941

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DanielRyanSmith
Copy link
Collaborator

Chromium usage is currently being displayed with inflated numbers (x100). This change updates the usage display to fix this bug.

Additionally, 0% usage values are explicitly displayed as "0.0%" rather than "N/A", and features with very small but non-zero usage are displayed as "<0.1%".

@@ -157,8 +157,15 @@ const renderChromiumUsage: CellRenderer = (
_options,
) => {
if (feature.usage?.chromium?.daily && feature.usage.chromium.daily > 0) {
// Format to display percentage with single decimal e.g. 0.8371 -> 83.7%.
return html`${(feature.usage.chromium.daily * 100).toFixed(1)}%`;
Copy link
Collaborator

@jcscottiii jcscottiii Nov 26, 2024

Choose a reason for hiding this comment

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

Apologies for my earlier confusing comment internally. It is still a ratio between 0 and 1 from the backend. I meant to say the presentation layer here should present a percentage at most 100%. (whereas right now, we see values way above 100%). Once we fix the data upstream, the ratios will go back to being between 0 and 1 (and we can continue with the existing logic to make it a percentage).

return html`${(feature.usage.chromium.daily * 100).toFixed(1)}%`;
// If the feature has some usage, but the usage is less than 0.1%,
// display it that way.
if (feature.usage.chromium.daily < 0.01) {
Copy link
Collaborator

@jcscottiii jcscottiii Nov 26, 2024

Choose a reason for hiding this comment

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

I do like this logic for very small numbers. Can you adjust it according to my comment above about how the number is indeed a ratio between 0 and 1.

Copy link
Collaborator

@jcscottiii jcscottiii left a comment

Choose a reason for hiding this comment

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

For both the regular case and the less than .1% case, we should have a hover over text that shows the precise number. This will help since we are truncating the values to a low number of decimal points.

Also, sorry again for the confusing comment internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants