Truncate data refresh percent change report to 3 digits after the decimal #1581
Labels
📄 aspect: text
Concerns the textual material in the repository
✨ goal: improvement
Improvement to an existing user-facing feature
good first issue
New-contributor friendly
help wanted
Open to participation from the community
🟩 priority: low
Low priority and doesn't need to be rushed
🧱 stack: catalog
Related to the catalog and Airflow DAGs
🔧 tech: airflow
Involves Apache Airflow
🐍 tech: python
Involves Python
Description
PR WordPress/openverse-catalog#636 added a count difference reporting message after the data refresh has been run. Part of this count is the percent change, which is given as a float. The difficulty with printing a straight float is that the numbers after the decimal can vary wildly. Here are a few examples:
We have a wide range of potential digits (in the hundreds to hundredths of a percent) and it can be hard to capture the level of information we would like for all cases. I think it would be best for us to have 3 significant digits after the decimal or closest zero, rounded up. This would mean for the above three cases the output would be:
368.8725687073269
->368.873
0.21550955625949816
->0.216
0.0001546016462204149
->0.000155
Alternatives
Leave as is, or do some basic string truncation which could leave us with values like
0.000%
.Implementation
The text was updated successfully, but these errors were encountered: