Add date and logic for zero cases to /cv
This commit is contained in:
@@ -87,9 +87,15 @@ cv(){
|
|||||||
cases=$(jq -r '.todayCases' <<< $stats)
|
cases=$(jq -r '.todayCases' <<< $stats)
|
||||||
pm=$(jq -r '.testsPerOneMillion' <<< $stats)
|
pm=$(jq -r '.testsPerOneMillion' <<< $stats)
|
||||||
pct=$(echo "scale = 2; $pm / 10000" | bc)
|
pct=$(echo "scale = 2; $pm / 10000" | bc)
|
||||||
|
if [ "$cases" == "0" ]
|
||||||
|
then
|
||||||
|
updated="Perhaps the stats are not updated yet?"
|
||||||
|
fi
|
||||||
if jq -re '.country' <<< $stats
|
if jq -re '.country' <<< $stats
|
||||||
then
|
then
|
||||||
sendmsg "Today's COVID-19 cases for $country: $cases \($pct% of the population tested\). Stay safe!"
|
sendmsg "Today's COVID-19 cases for $country: $cases \($pct% of the population tested\). Stay safe!
|
||||||
|
Queried at $(date +'%Y-%m-%d %H:%M') CET.
|
||||||
|
$updated"
|
||||||
else
|
else
|
||||||
sendmsg "This country doesn't have any stats!"
|
sendmsg "This country doesn't have any stats!"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user