From e4a7aa25773aba46ccfde396246133e175e18f3a Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Wed, 4 Mar 2020 01:19:26 +0000 Subject: [PATCH] Corona: add a decimal to percentage --- Corona/plugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Corona/plugin.py b/Corona/plugin.py index ef2c40c..f49e850 100644 --- a/Corona/plugin.py +++ b/Corona/plugin.py @@ -82,14 +82,14 @@ class Corona(callbacks.Plugin): confirmed += r.get('Confirmed') deaths += r.get('Deaths') recovered += r.get('Recovered') - local_ratio_dead = "{0:.00%}".format(deaths/confirmed) + local_ratio_dead = "{0:.1%}".format(deaths/confirmed) elif state: if search.lower() == state.lower(): location = state confirmed += r.get('Confirmed') deaths += r.get('Deaths') recovered += r.get('Recovered') - local_ratio_dead = "{0:.00%}".format(deaths/confirmed) + local_ratio_dead = "{0:.1%}".format(deaths/confirmed) else: state = state.split(',', 1) if search.lower() == state[0].lower().strip(): @@ -97,25 +97,25 @@ class Corona(callbacks.Plugin): confirmed += r.get('Confirmed') deaths += r.get('Deaths') recovered += r.get('Recovered') - local_ratio_dead = "{0:.00%}".format(deaths/confirmed) + local_ratio_dead = "{0:.1%}".format(deaths/confirmed) elif len(state) > 1 and search.lower() == state[1].lower().strip(): location = state[1].strip() confirmed += r.get('Confirmed') deaths += r.get('Deaths') recovered += r.get('Recovered') - local_ratio_dead = "{0:.00%}".format(deaths/confirmed) + local_ratio_dead = "{0:.1%}".format(deaths/confirmed) elif search.lower().replace('county', '').strip() == state[0].lower().replace('county', '').strip(): location = r.get('Province_State') confirmed += r.get('Confirmed') deaths += r.get('Deaths') recovered += r.get('Recovered') - local_ratio_dead = "{0:.00%}".format(deaths/confirmed) + local_ratio_dead = "{0:.1%}".format(deaths/confirmed) total_confirmed += r.get('Confirmed') total_deaths += r.get('Deaths') total_recovered += r.get('Recovered') - ratio_dead = "{0:.00%}".format(total_deaths/total_confirmed) + ratio_dead = "{0:.1%}".format(total_deaths/total_confirmed) template = self.registryValue("template", msg.channel) if location == 'Global':