about summary refs log tree commit diff stats
path: root/ara.pl
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-05-29 21:16:34 +0530
committerAndinus <andinus@nand.sh>2020-05-29 21:16:34 +0530
commit257d6cb747b4befee0e8c07aad7c5652382d1fa1 (patch)
treed6628e14c5ebdd6a2ddc39f06a2ede386746ebca /ara.pl
parente5d4c834bb293ca1963c765b91146722bd50fdbd (diff)
downloadara-257d6cb747b4befee0e8c07aad7c5652382d1fa1.tar.gz
Use statecode if state name is too long
Diffstat (limited to 'ara.pl')
-rwxr-xr-xara.pl12
1 files changed, 8 insertions, 4 deletions
diff --git a/ara.pl b/ara.pl
index c563e5e..21d9be3 100755
--- a/ara.pl
+++ b/ara.pl
@@ -87,11 +87,15 @@ foreach my $i (0...37) {
             substr( $lastupdatedtime, 0, 2 );
     }
 
-    push @$rows, [
-        # Limit the length to 18 characters, this will cut long state
-        # names.
-        substr( $statewise[0][$i]{'state'}, 0, 18 ),
+    my $state = $statewise[0][$i]{'state'};
+    $state = "India" if
+        $state eq "Total";
+
+    $state = $statewise[0][$i]{'statecode'} if
+        length($state) > 16;
 
+    push @$rows, [
+        $state,
         "$statewise[0][$i]{'confirmed'} (+$statewise[0][$i]{'deltaconfirmed'})" ,
         $statewise[0][$i]{'active'},
         "$statewise[0][$i]{'recovered'} (+$statewise[0][$i]{'deltadeaths'})",