about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-05 14:13:11 +0530
committerAndinus <andinus@nand.sh>2020-06-05 14:13:11 +0530
commite783d04eb5183d953d4ff16ed9c0b9b511914224 (patch)
tree4fe8852440a14c6f3edce19a31cfd72e6fe10387
parent1d6af525e818dcd589484ba66b61ab7a762a22dd (diff)
downloadara-e783d04eb5183d953d4ff16ed9c0b9b511914224.tar.gz
Show delta only if it was updated Today
-rwxr-xr-xara.pl19
1 files changed, 16 insertions, 3 deletions
diff --git a/ara.pl b/ara.pl
index 6580c65..fe0c9a5 100755
--- a/ara.pl
+++ b/ara.pl
@@ -93,12 +93,25 @@ foreach my $i (0...37) {
     $state = $statewise->[$i]{'statecode'} if
         length($state) > 16;
 
+    # Add delta only if it was updated Today.
+    my $confirmed = "$statewise->[$i]{confirmed}";
+    $confirmed .= " (+$statewise->[$i]{deltaconfirmed})" if
+        $update_info eq "Today";
+
+    my $recovered = "$statewise->[$i]{recovered}";
+    $recovered .= " (+$statewise->[$i]{deltadeaths})" if
+        $update_info eq "Today";
+
+    my $deaths = "$statewise->[$i]{deaths}";
+    $deaths .= " (+$statewise->[$i]{deltarecovered})" if
+        $update_info eq "Today";
+
     push @$rows, [
         $state,
-        "$statewise->[$i]{'confirmed'} (+$statewise->[$i]{'deltaconfirmed'})" ,
+        $confirmed,
         $statewise->[$i]{'active'},
-        "$statewise->[$i]{'recovered'} (+$statewise->[$i]{'deltadeaths'})",
-        "$statewise->[$i]{'deaths'} (+$statewise->[$i]{'deltarecovered'})",
+        $recovered,
+        $deaths,
         $update_info,
         ];
 }