Re-add data file removal logic

This commit is contained in:
2020-07-25 17:34:01 +02:00
parent 4af0be1423
commit eddeff6618

19
cv
View File

@@ -4,8 +4,8 @@ ex(){
echo -e "> ${*}" echo -e "> ${*}"
$@ $@
} }
date=$(date +"%Y-%m-%d") [ -z $date ] && date=$(date +"%Y-%m-%d")
ydate=$(date -d yesterday +"%Y-%m-%d") [ -z $ydate ] && ydate=$(date -d yesterday +"%Y-%m-%d")
title(){ title(){
w=36 w=36
printf "║ %-${w}s ║\n" "${*}" printf "║ %-${w}s ║\n" "${*}"
@@ -63,10 +63,23 @@ result(){
out Recovered recovered out Recovered recovered
out Tests tests out Tests tests
out "╰> Per 1M" testsPerOneMillion out "╰> Per 1M" testsPerOneMillion
if [ ! -f $data/$ydate-$country ] if [ ! -f $data/$ydate-$country ] || [ $(get todayCases) == "0" ]
then then
frame line frame line
if [ ! -f $data/$ydate-$country ]
then
title "Stats for $country appear new." title "Stats for $country appear new."
fi
if [ $(get todayCases) == "0" ]
then
if [ -z $norm ]
then
title "New cases are 0. Removing data file."
rm $data/$date-$country
else
title "New cases are 0. Keeping data file."
fi
fi
frame bot frame bot
else else
frame down frame down