05/31 Template fix
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user