Skip to content

Conversation

Igr1x
Copy link
Contributor

@Igr1x Igr1x commented Oct 2, 2025

  • Simplify format_number_short to use fixed 2 decimal places
  • Remove unused format_significant function
  • Canonize unit test

@AMDmi3
Copy link
Member

AMDmi3 commented Oct 2, 2025

Simplify format_number_short to use fixed 2 decimal places

Sorry, that's not quite what I've meant, I've meant 2 significant digits (as opposed to current 3). That would be, roughly
x.to_string() if x < 1000
format!("{:.1}k", x as f32 / 1000.0) if x >= 1000 x <= 9950
format!("{:.0}k", x as f32 / 1000.0) otherwise

9950 is due to rounding, and it would make sense to add 9949, 9950, 9951 cases to tests

@Igr1x Igr1x force-pushed the fix/format_number branch from 748792d to b3f0465 Compare October 7, 2025 15:37
@Igr1x
Copy link
Contributor Author

Igr1x commented Oct 7, 2025

Rewrote the function and added tests.
Also updated the snapshot tests repology/repology-webapp-test-snapshots#1

@AMDmi3 AMDmi3 merged commit e1313ec into repology:master Oct 7, 2025
1 check passed
@AMDmi3
Copy link
Member

AMDmi3 commented Oct 7, 2025

Just perfect, thank you. Repository tables are now much less noisy.

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