backend: log download progress with fixed precision numbers #3425
+6
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will greatly reduce the amount of jumping columns due to numbers pretty printing the fractional part and dropping ".000"
Ideally one would use i18n locale-aware format with Intl.NumberFormat, there it seems possible to match the width+precision parameters from printf in C.
I based the code on this example:
So if for example previously it looked like this:
With the fixed precision:
If the integer part jumps from 9 to 10, it'll still get wider but it's still an improvement. I did not format progress.bytes because it's never parsed into integer/float above.
Finally there's a fair amount of duplicated code between gog/epic/nile games.ts. Someone with an idea of TS might want to take a look at.
Nothing tested, I don't have a working dev install either. This is only a proposal.
Use the following Checklist if you have changed something on the Backend or Frontend: