From a4175e0929356f897ff4e80709afc7c9a67645fe Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Fri, 13 Mar 2020 00:57:36 +0000 Subject: [PATCH] Corona: fix last update for CSV source --- Corona/plugin.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Corona/plugin.py b/Corona/plugin.py index 4e4f144..f61c15f 100644 --- a/Corona/plugin.py +++ b/Corona/plugin.py @@ -508,24 +508,35 @@ class Corona(callbacks.Plugin): confirmed += int(r.get('Confirmed')) deaths += int(r.get('Deaths')) recovered += int(r.get('Recovered')) - time = int(r.get('Last_Update')) + if api: + time = int(r.get('Last_Update')) + if git: + time = datetime.datetime.strptime(r.get('Last Update'), "%Y-%m-%dT%H:%M:%S") + time = int(time.timestamp()*1000) if time > updated: updated = time - local_ratio_dead = "{0:.1%}".format(deaths/confirmed) elif state and search.lower() == state.lower(): location = state confirmed += int(r.get('Confirmed')) deaths += int(r.get('Deaths')) recovered += int(r.get('Recovered')) - time = int(r.get('Last_Update')) + if api: + time = int(r.get('Last_Update')) + if git: + time = datetime.datetime.strptime(r.get('Last Update'), "%Y-%m-%dT%H:%M:%S") + time = int(time.timestamp()*1000) if time > updated: updated = time local_ratio_dead = "{0:.1%}".format(deaths/confirmed) total_confirmed += int(r.get('Confirmed')) total_deaths += int(r.get('Deaths')) total_recovered += int(r.get('Recovered')) - time = int(r.get('Last_Update')) + if api: + time = int(r.get('Last_Update')) + if git: + time = datetime.datetime.strptime(r.get('Last Update'), "%Y-%m-%dT%H:%M:%S") + time = int(time.timestamp()*1000) if time > last_update: last_update = time ratio_dead = "{0:.1%}".format(total_deaths/total_confirmed)