Re-add data file removal logic

This commit is contained in:
Michael De Roover 2020-07-25 17:34:01 +02:00
parent 4af0be1423
commit eddeff6618
Signed by: vim
GPG Key ID: 075496E232CE04CB
1 changed files with 17 additions and 4 deletions

21
cv
View File

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