home · contact · privacy
Auto-open sum details in HTML table.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 3 Jul 2020 19:31:24 +0000 (21:31 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 3 Jul 2020 19:31:24 +0000 (21:31 +0200)
enhance_table.py

index 0b30d216f5105d66391251659427caa7903f316a..785e231a681b8f0862fa206eeaf1fc80c7c42faf 100755 (executable)
@@ -145,6 +145,7 @@ if output_type == 'html':
               'transform: rotate(180deg);">%s</th>' % long_form)
     print('</tr>')
     sorted_dates.reverse()
+    sum_district = sorted_districts[-1]
     for date in sorted_dates:
         print('<tr>')
         print('<td>%s</td>' % date)
@@ -163,7 +164,10 @@ if output_type == 'html':
                 week_inc = '%.1f' % district_data['week_incidence']
             print('<td>')
             print(new_infections)
-            print('<details><summary></summary><table>')
+            if district == sum_district:
+                print('<details open><summary></summary><table>')
+            else:
+                print('<details><summary></summary><table>')
             print('<tr><th>%s</th><td>%s</td></tr>' % (long_wsum, week_sum))
             print('<tr><th>%s</th><td>%s</td></tr>' % (long_wavg, week_avg))
             print('<tr><th>%s</th><td>%s</td></tr>' % (long_winc, week_inc))