Fix issue with querying yesterday's stats without a data file

This commit is contained in:
2020-05-12 14:49:08 +02:00
parent 34dbc57e75
commit 0eaf2a62a9

31
cv
View File

@@ -41,23 +41,28 @@ result(){
echo "Active: $(get active)"
echo "New: $(get todayCases)"
echo "Tests: $(get tests)"
show "Yesterday's stats:"
echo "New: $(yget todayCases)"
if [ $(get todayCases) == "0" ]
if [ -f $data/$ydate-$country ]
then
show "Seems like the cases today are not yet updated."
show "The data file will be removed. Please query again later."
ex "rm $data/$date-$country"
elif [ $(get todayCases) == $(yget todayCases) ]
then
show "Seems like the stats are the same as yesterday."
show "This could be normal but may mean that the data file is still yesterday's."
show "Do you want to remove it?"
read -p "Answer (y/n): " answer
if [ "$answer" == "y" ]
show "Yesterday's stats:"
echo "New: $(yget todayCases)"
if [ $(get todayCases) == "0" ]
then
show "Seems like the cases today are not yet updated."
show "The data file will be removed. Please query again later."
ex "rm $data/$date-$country"
elif [ $(get todayCases) == $(yget todayCases) ]
then
show "Seems like the stats are the same as yesterday."
show "This could be normal but may mean that the data file is still yesterday's."
show "Do you want to remove it?"
read -p "Answer (y/n): " answer
if [ "$answer" == "y" ]
then
ex "rm $data/$date-$country"
fi
fi
else
show "Yesterday's data file for this country doesn't exist."
fi
}