Commit 0c3b23bc authored by betseg's avatar betseg 🏳🌈

add active percentages to telegram

parent 73da1c98
......@@ -37,7 +37,7 @@ def create_message(country, old_data, all_data):
death_percentage = per(deaths, cases)
recovery_percentage = per(recoveries, cases)
case_str = f"{cases} ({active_cases} active)"
case_str = f"{cases} ({active_cases} active"
death_str = f"{deaths} ({death_percentage}%)"
recovery_str = f"{recoveries} ({recovery_percentage}%)"
......@@ -46,13 +46,18 @@ def create_message(country, old_data, all_data):
old_deaths = old_data[country]["deaths"]
old_recoveries = old_data[country]["recoveries"]
old_active = old_cases - old_deaths - old_recoveries
case_diff = cases - old_cases
death_diff = deaths - old_deaths
recovery_diff = recoveries - old_recoveries
active_diff = active_cases - old_active
case_str += f" ({case_diff} new cases ({per(case_diff, old_cases):+}%))" if case_diff else ""
case_str += f"({per(active_diff, old_active):+}%)) ({case_diff} new cases ({per(case_diff, old_cases):+}%))" if case_diff else ""
death_str += f" ({death_diff} new deaths ({per(death_diff, old_deaths):+}%))" if death_diff else ""
recovery_str += f" ({recovery_diff} new recoveries ({per(recovery_diff, old_recoveries):+}%))" if recovery_diff else ""
else:
case_str += ")"
return f"""
**COVID-19 Statistics for {country}:**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment