about summary refs log tree commit diff stats
path: root/ara.pl
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-05 22:45:39 +0530
committerAndinus <andinus@nand.sh>2020-06-05 22:45:39 +0530
commit97cd205a15d1c405a14560faf26a52f1ac5f289d (patch)
tree9430f5d4b693ab5a1ddf6f04f8e823a4a585859d /ara.pl
parent68009b0312418aca6df486c2bb28a8f792b481c0 (diff)
downloadara-97cd205a15d1c405a14560faf26a52f1ac5f289d.tar.gz
Print state notes along with covid-19 data
Diffstat (limited to 'ara.pl')
-rwxr-xr-xara.pl20
1 files changed, 16 insertions, 4 deletions
diff --git a/ara.pl b/ara.pl
index 0163064..9581417 100755
--- a/ara.pl
+++ b/ara.pl
@@ -76,10 +76,15 @@ my $statewise = $json_data->{statewise};
 # Map month number to Months.
 my @months = qw( lol Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
 
-my $rows = [
+my $covid_19_data = [
     ['State', 'Confirmed', 'Active', 'Recovered', 'Deaths', 'Last Updated'],
     ];
 
+my $state_notes = [
+    ['State', 'Notes'],
+    ];
+
+
 my $today = DateTime->now( time_zone => 'Asia/Kolkata' );
 
 # Add first 37 entries to $rows.
@@ -122,7 +127,7 @@ foreach my $i (0...37) {
         $deaths .= " (+$statewise->[$i]{deltadeaths})";
     }
 
-    push @$rows, [
+    push @$covid_19_data, [
         $state,
         $confirmed,
         $statewise->[$i]{'active'},
@@ -130,7 +135,14 @@ foreach my $i (0...37) {
         $deaths,
         $update_info,
         ];
+
+    push @$state_notes, [
+        $state,
+        $statewise->[$i]{statenotes},
+        ] unless
+        length($statewise->[$i]{statenotes}) eq 0;
 }
 
-# Generate table.
-say generate_table(rows => $rows, header_row => 1);
+# Generate tables.
+say generate_table(rows => $covid_19_data, header_row => 1);
+say generate_table(rows => $state_notes, header_row => 1);