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 display of size values in web interface #2703

Merged
merged 5 commits into from Feb 24, 2022

Conversation

1100101
Copy link
Contributor

@1100101 1100101 commented Feb 24, 2022

The web interface rounded large number values down using Math.floor(), causing the web interface to display faulty torrent/download sizes.
For example, a torrent of size 1,92 GB (915 pieces @ 2,1 MB) was shown as "1GB".
After about half the download was done, the UI showed "1GB of 1GB (55%)", which is rather irritating.

This fix removes the Math.floor() and adds fractions to the larger size values.

I also added maximumFractionDigits to the download speed formatters, because 2.234MB/s kinda looks weird.

Note: Is there a reason Transmission uses SI notation for file sizes?
For one, the display of the piece size is affected, as the piece size in my example is 2097152 bytes, which is 2MiB, but 2.1MB, which I find to look weird.
Also, the file size displayed by the Transmission UI is not the same size the file actually occupies on the disc, which may also be confusing.

The web interface rounded large number values down using Math.floor(),
causing the web interface to display faulty torrent/download sizes.
A torrent of size 1,92 GB (915 pieces @ 2,1 MB) was shown as "1GB".
After about half the download was done, the UI showed "1GB of 1GB (55%)", which is rather irritating.

The fix removes the `Math.floor()` and adds fractions to the larger size values.
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

Thanks!

one issue: please fix the new linter warning

@ckerr
Copy link
Member

ckerr commented Feb 24, 2022

Note: Is there a reason Transmission uses SI notation for file sizes? For one, the display of the piece size is affected, as the piece size in my example is 2097152 bytes, which is 2MiB, but 2.1MB, which I find to look weird. Also, the file size displayed by the Transmission UI is not the same size the file actually occupies on the disc, which may also be confusing.

Historical reasons. #198 has some context, and links to older issues that give more context.

I'd be fine with a PR that changed it for piece size

@ckerr ckerr merged commit cc7d1c5 into transmission:main Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants