From 1e1250700f80cb13fba848c3b19fb5582deeb09a Mon Sep 17 00:00:00 2001 From: Nick80835 Date: Fri, 25 Sep 2020 19:30:21 -0400 Subject: [PATCH] fucking zeroes --- ubot/modules/scrapers.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ubot/modules/scrapers.py b/ubot/modules/scrapers.py index 8e55aa3..62245da 100644 --- a/ubot/modules/scrapers.py +++ b/ubot/modules/scrapers.py @@ -181,8 +181,8 @@ async def corona(event): response_list = [ f"Corona stats for **{response['country']}**\n", f"**Cases**\n {response['cases']} total\n {response['todayCases']} today\n {response['active']} active\n {round(response['cases'] / response['population'] * 100, 2)}% of population", - f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2)}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", - f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2)}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", + f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2) if response['tests'] != 0 else 0.0}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", + f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2) if response['cases'] != 0 else 0.0}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", f"**Recoveries**\n {response['recovered']} total" ] @@ -198,8 +198,8 @@ async def corona(event): response_list = [ f"Global Corona stats\n", f"**Cases**\n {response['cases']} total\n {response['todayCases']} today\n {response['active']} active\n {round(response['cases'] / response['population'] * 100, 2)}% of population", - f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2)}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", - f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2)}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", + f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2) if response['tests'] != 0 else 0.0}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", + f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2) if response['cases'] != 0 else 0.0}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", f"**Recoveries**\n {response['recovered']} total" ] @@ -218,8 +218,8 @@ async def corona_inline(event): response_list = [ f"Corona stats for **{response['country']}**\n", f"**Cases**\n {response['cases']} total\n {response['todayCases']} today\n {response['active']} active\n {round(response['cases'] / response['population'] * 100, 2)}% of population", - f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2)}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", - f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2)}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", + f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2) if response['tests'] != 0 else 0.0}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", + f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2) if response['cases'] != 0 else 0.0}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", f"**Recoveries**\n {response['recovered']} total" ] @@ -234,8 +234,8 @@ async def corona_inline(event): response_list = [ f"Global Corona stats\n", f"**Cases**\n {response['cases']} total\n {response['todayCases']} today\n {response['active']} active\n {round(response['cases'] / response['population'] * 100, 2)}% of population", - f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2)}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", - f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2)}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", + f"**Tests**\n {response['tests']} total\n {round(response['cases'] / response['tests'] * 100, 2) if response['tests'] != 0 else 0.0}% positive\n {round(response['tests'] / response['population'] * 100, 2)}% of population", + f"**Deaths**\n {response['deaths']} total\n {response['todayDeaths']} today\n {round(response['deaths'] / response['cases'] * 100, 2) if response['cases'] != 0 else 0.0}% of cases\n {round(response['deaths'] / response['population'] * 100, 2)}% of population", f"**Recoveries**\n {response['recovered']} total" ]