Skip to content

Commit 44f4da1

Browse files
author
ExpDev07
committed
Fixed error if latest history entry is an empty string which can't be parsed to number
1 parent 56a7443 commit 44f4da1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/data/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ def get_data(category):
3333
# Filter out all the dates.
3434
history = dict(filter(lambda element: date_util.is_date(element[0]), item.items()))
3535

36+
# Country for this location.
3637
country = item['Country/Region']
3738

39+
# Latest data insert.
40+
latest = list(history.values())[-1];
41+
3842
# Normalize the item and append to locations.
3943
locations.append({
4044
# General info.
@@ -52,7 +56,7 @@ def get_data(category):
5256
'history': history,
5357

5458
# Latest statistic.
55-
'latest': int(list(history.values())[-1]),
59+
'latest': int(latest) if latest else 0,
5660
})
5761

5862
# Latest total.

0 commit comments

Comments
 (0)