home · contact · privacy
Add week day name display.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 4 Jul 2020 11:20:31 +0000 (13:20 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 4 Jul 2020 11:20:31 +0000 (13:20 +0200)
enhance_table.py

index 4a060a4b758a654ee5593662cf0f66386e037bf1..ab6ec46f071ce88484503007d163569759369eb1 100755 (executable)
@@ -134,6 +134,7 @@ for i in range(len(sorted_dates)):
         db[district][date]['week_incidence'] = (week_sum / district_pop) * 100000
 
 # Optimized for web browser viewing.
+import calendar
 if output_type == 'html':
     print("""<!DOCTYPE html>
 <html>
@@ -170,7 +171,8 @@ th { text-align: left; vertical-align: bottom; }
                       (translate[district], district))
             print('</tr>')
         print('<tr class="day_row">')
-        print('<td>%s</td>' % date)
+        weekday = calendar.day_name[datetime.date.fromisoformat(date).weekday()]
+        print('<td>%s<br />(%s)</td>' % (date, weekday))
         print('<td><table>')
         for abbr in ['+', 'Σ', 'Ø', 'i']:
             print('<tr><th><abbr title="%s">%s</abbr></th></tr>' %
@@ -237,7 +239,8 @@ HTML view: https://plomlompom.com/berlin_corona.html"""
             print('-'*77)
 
         # Day table.
-        print(date)
+        weekday = calendar.day_name[datetime.date.fromisoformat(date).weekday()]
+        print('%s (%s)' % (date, weekday))
         new_infections = []
         weekly_sums = []
         weekly_avgs = []