Merge percentage and per 1M stats
This commit is contained in:
parent
5bbfc4ad77
commit
36c655cec0
29
cv
29
cv
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Variable declarations go here.
|
||||
w=11
|
||||
w=14
|
||||
dfmt="+%Y-%m-%d"
|
||||
data="$HOME/Documents/cv"
|
||||
country=$1
|
||||
|
@ -22,7 +22,7 @@ ex(){
|
|||
$@
|
||||
}
|
||||
title(){
|
||||
local w=39
|
||||
local w=48
|
||||
printf "║ %-${w}s ║\n" "${*}"
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,8 @@ get(){
|
|||
jq -r ".$1" < "$data/$date-$country"
|
||||
fi
|
||||
}
|
||||
getpct(){
|
||||
out "" "$(echo "$(bc <<< "scale = 1; $(get $1) / 10000") %")" ""
|
||||
getpm(){
|
||||
out "╰> Per 1M " "$(get $1) ($(echo "$(bc <<< "scale = 1; $(get $1) / 10000")%"))" ""
|
||||
}
|
||||
yget(){
|
||||
date=$ydate
|
||||
|
@ -55,13 +55,13 @@ out(){
|
|||
}
|
||||
frame(){
|
||||
case "$1" in
|
||||
top) printf "╔═════════════════════════════════════════╗\n" ;;
|
||||
title) printf "║ Statistic ║ Today ║ Yesterday ║\n" ;;
|
||||
sep) printf "╟─────────────╫─────────────╫─────────────╢\n" ;;
|
||||
up) printf "╠═════════════╦═════════════╦═════════════╣\n" ;;
|
||||
down) printf "╚═════════════╩═════════════╩═════════════╝\n" ;;
|
||||
line) printf "╠═════════════╩═════════════╩═════════════╣\n" ;;
|
||||
bot) printf "╚═════════════════════════════════════════╝\n" ;;
|
||||
top) printf "╔══════════════════════════════════════════════════╗\n" ;;
|
||||
title) printf "║ Statistic ║ Today ║ Yesterday ║\n" ;;
|
||||
sep) printf "╟────────────────╫────────────────╫────────────────╢\n" ;;
|
||||
up) printf "╠════════════════╦════════════════╦════════════════╣\n" ;;
|
||||
down) printf "╚════════════════╩════════════════╩════════════════╝\n" ;;
|
||||
line) printf "╠════════════════╩════════════════╩════════════════╣\n" ;;
|
||||
bot) printf "╚══════════════════════════════════════════════════╝\n" ;;
|
||||
esac
|
||||
}
|
||||
result(){
|
||||
|
@ -71,17 +71,16 @@ result(){
|
|||
frame title
|
||||
frame sep
|
||||
stats Total cases
|
||||
stats "╰> Per 1M " casesPerOneMillion
|
||||
getpm casesPerOneMillion
|
||||
stats New todayCases
|
||||
frame sep
|
||||
stats Active active
|
||||
stats Critical critical
|
||||
stats Deaths deaths
|
||||
stats "╰> Per 1M " deathsPerOneMillion
|
||||
getpm deathsPerOneMillion
|
||||
stats Recovered recovered
|
||||
stats Tests tests
|
||||
stats "╰> Per 1M " testsPerOneMillion
|
||||
getpct testsPerOneMillion
|
||||
getpm testsPerOneMillion
|
||||
if [ ! -f $data/$ydate-$country ] || [ $(get todayCases) == "0" ]
|
||||
then
|
||||
frame line
|
||||
|
|
Reference in New Issue