From ef830881ea19fe5686220b66f07591307a4948a8 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 4 Jul 2020 03:08:29 +0200 Subject: [PATCH] Fix. --- enhance_table.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/enhance_table.py b/enhance_table.py index f8add4e..975abd8 100755 --- a/enhance_table.py +++ b/enhance_table.py @@ -239,10 +239,14 @@ HTML view: https://plomlompom.com/berlin_corona.html""" weekly_avgs = [] weekly_incs = [] for district in sorted_districts: - new_infections += [db[district][date]['new_infections']] - weekly_sums += [db[district][date]['week_sum']] - weekly_avgs += [db[district][date]['week_average']] - weekly_incs += [db[district][date]['week_incidence']] + district_day_data = db[district][date] + new_infections += [district_day_data['new_infections']] + if 'week_sum' in district_day_data: + weekly_sums += [district_day_data['week_sum']] + if 'week_average' in district_day_data: + weekly_avgs += [district_day_data['week_average']] + if 'week_incidence' in district_day_data: + weekly_incs += [district_day_data['week_incidence']] print('+', ' '*11, ' '.join(['%3s' % i for i in new_infections])) print('Σ', ' '*10, ' '.join(['%4s' % wsum for wsum in weekly_sums])) print('Ø', ' '*9, ''.join(['%5.1f' % wavg for wavg in weekly_avgs])) -- 2.30.2