Commit 1acf363e authored by Daniel Kullmann's avatar Daniel Kullmann

Fixes bug in average calculation

parent 06408bcf
...@@ -59,8 +59,8 @@ def calculate_moving_average(values, all_countries, all_dates): ...@@ -59,8 +59,8 @@ def calculate_moving_average(values, all_countries, all_dates):
if average_date not in result[country]: if average_date not in result[country]:
result[country][average_date] = {} result[country][average_date] = {}
for key in corona.all_keys: for key in corona.all_keys:
if average_date in values[country] and key in values[country][average_date]: if date in values[country] and key in values[country][date]:
value = values[country][average_date][key] value = values[country][date][key]
if key not in result[country][average_date]: if key not in result[country][average_date]:
result[country][average_date][key] = {"sum": 0, "count": 0} result[country][average_date][key] = {"sum": 0, "count": 0}
result[country][average_date][key]["sum"] += value result[country][average_date][key]["sum"] += value
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment