1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 20:17:45 +01:00

Merge pull request #1869 from vgerak/1836-ddg-weather

Fix floating point format in DDG weather humidity
This commit is contained in:
Alexandre Flament 2022-11-05 22:46:50 +01:00 committed by GitHub
commit 4fe5463671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,12 +39,12 @@ def generate_condition_table(condition):
res += (
f"<tr><td>{gettext('Wind')}</td><td>{condition['windBearing']}° — "
f"{'%.2f' % (condition['windSpeed'] * 1.6093440006147)} km/h / {condition['windSpeed']} mph</td></tr>"
f"{(condition['windSpeed'] * 1.6093440006147):.2f} km/h / {condition['windSpeed']} mph</td></tr>"
)
res += f"<tr><td>{gettext('Visibility')}</td><td>{condition['visibility']} km</td>"
res += f"<tr><td>{gettext('Humidity')}</td><td>{condition['humidity'] * 100}%</td></tr>"
res += f"<tr><td>{gettext('Humidity')}</td><td>{(condition['humidity'] * 100):.1f}%</td></tr>"
return res