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

Add scientific notation filter #1077

Merged
merged 11 commits into from
Aug 28, 2024
Merged

Add scientific notation filter #1077

merged 11 commits into from
Aug 28, 2024

Conversation

munnsmunns
Copy link
Collaborator

@munnsmunns munnsmunns commented Aug 12, 2024

Add a template filter that formats floats in scientific notation when <=1e-5 or >1e5, and use that filter when displaying assessment values.

Copy link
Collaborator

@rabstejnek rabstejnek left a comment

Choose a reason for hiding this comment

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

Looks good! I had one comment for you to address, which may result in updating the code documentation to be more clear about the behavior or changing the template filter to ignore large values.

hawc/apps/common/templatetags/hawc.py Outdated Show resolved Hide resolved
Copy link
Owner

@shapiromatron shapiromatron left a comment

Choose a reason for hiding this comment

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

Made a stylistic change to the filter itself, and did more work on the tests, so it self-documents what this filter returns.



class TestENotation:
@pytest.mark.parametrize(
Copy link
Owner

Choose a reason for hiding this comment

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

this makes it very clear what this filter does. I'd recommend doing something like this in the future so there's no ambiguity in what the filter looks like.

@shapiromatron shapiromatron merged commit 1660e1a into main Aug 28, 2024
6 checks passed
@shapiromatron shapiromatron deleted the values-e-notation branch August 28, 2024 16:54
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.

3 participants