diff --git a/generate-json-files.py b/generate-json-files.py index fe54ac3587f233ec046f28a8669b5f9803e14aeb..e4e9293db8f57ff96b1ebe848a2dc211356460a3 100644 --- a/generate-json-files.py +++ b/generate-json-files.py @@ -59,8 +59,8 @@ def calculate_moving_average(values, all_countries, all_dates): if average_date not in result[country]: result[country][average_date] = {} for key in corona.all_keys: - if average_date in values[country] and key in values[country][average_date]: - value = values[country][average_date][key] + if date in values[country] and key in values[country][date]: + value = values[country][date][key] if key not in result[country][average_date]: result[country][average_date][key] = {"sum": 0, "count": 0} result[country][average_date][key]["sum"] += value