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: rounding large files #622

Merged
merged 6 commits into from
Sep 5, 2024

Conversation

ayushpoddar
Copy link
Contributor

@ayushpoddar ayushpoddar commented Jul 31, 2024

Description

  • Relevant Issues : Rounding bug for large files #600
  • Relevant PRs : (none)
  • Type of change :
    • New feature
    • Bug fix for existing feature
    • Code quality improvement
    • Addition or Improvement of tests
    • Addition or Improvement of documentation

@ayushpoddar ayushpoddar mentioned this pull request Jul 31, 2024
1 task
@ayushpoddar
Copy link
Contributor Author

@avdv Can you please take a look here

@@ -280,11 +280,21 @@ def chars_for_size
end

def justify_size_info(size)
size_num = size[0][0..-4].rjust(chars_for_size, ' ')
size_num = displayable_size_num(size[0]).rjust(chars_for_size, ' ')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of parsing the string after conversion, just use filesize.pretty(precision: 0) and filesize.to_s('B', precision: 0) respectively, in the tertiary expression in the line 263 in size_info. Then just change this to

size_num = size[0].rjust(chars_for_size, ' ')

Copy link
Collaborator

@avdv avdv left a comment

Choose a reason for hiding this comment

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

Thank you @ayushpoddar! I hope you don't mind me hijacking your PR to fix CI and refactor according to my comment above.

@avdv avdv merged commit 9914606 into athityakumar:main Sep 5, 2024
10 checks passed
@avdv avdv mentioned this pull request Sep 9, 2024
5 tasks
@ayushpoddar
Copy link
Contributor Author

Thank you @ayushpoddar! I hope you don't mind me hijacking your PR to fix CI and refactor according to my comment above.

No issues @avdv. I am glad you took over since I wasn't available for making the requested changes

@ayushpoddar ayushpoddar deleted the fix/rounding-large-files branch September 12, 2024 03:52
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