X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7Bcard_id%7D%7D/test.html?a=blobdiff_plain;f=enhance_table.py;h=7410589f98c8b33f0d571121767217819b3fc973;hb=c56f4c68792bd6539c83b04876e81d29ae0d2c95;hp=0b30d216f5105d66391251659427caa7903f316a;hpb=049ba1c6850f9344523f8efd46c837a6c15263ee;p=berlin-corona-table
diff --git a/enhance_table.py b/enhance_table.py
index 0b30d21..7410589 100755
--- a/enhance_table.py
+++ b/enhance_table.py
@@ -131,22 +131,32 @@ for i in range(len(sorted_dates)):
# Optimized for web browser viewing.
if output_type == 'html':
- print('')
- print('')
- print('
')
- print('')
- print('date | ')
+ print("""
+
+
+
+Table of Berlin's Corona infection number development by districts
+
+Table of Berlin's Corona infection number development by districts
+Updated daily at 9pm. Source code. Text view optimized for terminal curl.
+
+
+date | """)
+ sorted_dates.reverse()
+ sum_district = sorted_districts[-1]
for district in sorted_districts:
long_form = translate[district]
- print('%s | ' % long_form)
+ if sum_district == district:
+ print('%s | ' % long_form)
+ else:
+ print('%s | ' % long_form)
print('
')
- sorted_dates.reverse()
for date in sorted_dates:
- print('')
+ print('
')
print('%s | ' % date)
long_wsum = translate['wsum']
long_wavg = translate['wavg']
@@ -163,11 +173,15 @@ if output_type == 'html':
week_inc = '%.1f' % district_data['week_incidence']
print('')
print(new_infections)
- print('
')
+ if district != sum_district:
+ print('')
+ print('')
print('%s | %s | ' % (long_wsum, week_sum))
print('%s | %s | ' % (long_wavg, week_avg))
print('%s | %s | ' % (long_winc, week_inc))
- print(' ')
+ print(' ')
+ if district != sum_district:
+ print(' ')
print(' | ')
print('
')
print('
')
@@ -179,7 +193,7 @@ elif output_type == 'txt':
# Explain what this is.
intro = \
"""Table of Berlin's Corona infection number development by districts.
-Updated daily around 9pm.
+Updated daily at 9pm.
Abbrevations/explanations:
"""
@@ -187,6 +201,8 @@ Abbrevations/explanations:
intro += "%s: %s\n" % (k, translate[k])
intro += """
Source code: https://plomlompom.com/repos/?p=berlin-corona-table
+
+HTML view: https://plomlompom.com/berlin_corona.html
"""
print(intro)