From 1acf363ec2d735b52d5d83918e1c15e3df2fb763 Mon Sep 17 00:00:00 2001 From: Daniel Kullmann Date: Fri, 24 Jul 2020 13:11:30 +0200 Subject: [PATCH] Fixes bug in average calculation --- generate-json-files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate-json-files.py b/generate-json-files.py index fe54ac3..e4e9293 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 -- GitLab