Corona: add state/province searching

This commit is contained in:
oddluck 2020-03-03 23:28:17 +00:00
parent edc9c625f7
commit 55d2fd24b2

View File

@ -73,11 +73,20 @@ class Corona(callbacks.Plugin):
r = region.get('attributes')
if search:
name = r.get('Country_Region')
region = r.get('Country_Region')
state = r.get('Province_State')
if state and ',' in state:
state = state.split(',', 1)[1].strip()
if 'china' in search.lower():
search = 'mainland china'
if search.lower() == name.lower():
location = name
if region and search.lower() == region.lower():
location = region
confirmed += r.get('Confirmed')
deaths += r.get('Deaths')
recovered += r.get('Recovered')
local_ratio_dead = "{0:.00%}".format(deaths/confirmed)
elif state and search.lower() == state.lower():
location = state
confirmed += r.get('Confirmed')
deaths += r.get('Deaths')
recovered += r.get('Recovered')