05/31 Template fix

This commit is contained in:
2026-05-31 21:30:57 -04:00
parent 8b1594da5a
commit 842923cb89
3 changed files with 13 additions and 2 deletions
+11
View File
@@ -62,4 +62,15 @@ def create_app(config_name=None):
def percent_filter(value):
return format_percent(value)
@app.template_filter('shares')
def shares_filter(value):
"""Format share quantity — strips trailing zeros, keeps up to 8 decimal places."""
try:
f = float(value)
except (TypeError, ValueError):
return '0'
# Format to 8 decimal places then strip trailing zeros
s = '{:.8f}'.format(f).rstrip('0').rstrip('.')
return s if s else '0'
return app