about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-08 18:26:45 +0530
committerAndinus <andinus@nand.sh>2020-06-08 18:26:45 +0530
commitb4e3aa288325e8541caaa30b53c9e6ced25273a4 (patch)
treead44027b325a862d2b1e30973b6a55a49860b433
parentdd3aa452e9d114ed12ba6c05ff5feec55765914c (diff)
downloadara-b4e3aa288325e8541caaa30b53c9e6ced25273a4.tar.gz
Don't add '+' to deltaconfirmed if it's a negative number
"State Unassigned" had deltaconfirmed of -773 today which showed up as
"+-773".
-rwxr-xr-xara.pl7
1 files changed, 6 insertions, 1 deletions
diff --git a/ara.pl b/ara.pl
index 1c28fe9..963720d 100755
--- a/ara.pl
+++ b/ara.pl
@@ -180,7 +180,12 @@ foreach my $i ( 0 ... $rows_to_print - 1  ) {
 
         # Add delta only if it was updated Today.
         if ( $update_info eq "Today" ) {
-            $confirmed .= " (+$statewise->[$i]{deltaconfirmed})";
+            if ( $statewise->[$i]{deltaconfirmed} >= 0 ) {
+                $confirmed .= " (+$statewise->[$i]{deltaconfirmed})";
+            } else {
+                $confirmed .= " ($statewise->[$i]{deltaconfirmed})";
+            }
+
             $recovered .= " (+$statewise->[$i]{deltarecovered})";
             $deaths .= " (+$statewise->[$i]{deltadeaths})";
         }