Adding nice Balance at the moment
This commit is contained in:
parent
f0aca745f5
commit
29a306f988
31
badgy
31
badgy
@ -24,21 +24,34 @@ devalidate()
|
|||||||
|
|
||||||
s2h()
|
s2h()
|
||||||
{
|
{
|
||||||
local sc=${1}
|
local sc=0
|
||||||
|
local sign=""
|
||||||
|
if [ ${1} -lt 0 ]; then
|
||||||
|
sign="-"
|
||||||
|
sc=$(echo ${1} | cut -c2-)
|
||||||
|
else
|
||||||
|
sc=${1}
|
||||||
|
fi
|
||||||
local h=$(( sc / 3600))
|
local h=$(( sc / 3600))
|
||||||
local m=$(( (sc % 3600) / 60 ))
|
local m=$(( (sc % 3600) / 60 ))
|
||||||
local s=$(( sc % 60))
|
local s=$(( sc % 60))
|
||||||
printf "%dh%02dm" "${h}" "${m}"
|
printf "%s%dh%02dm" "${sign}" "${h}" "${m}"
|
||||||
}
|
}
|
||||||
|
|
||||||
getNewBalance()
|
getNewBalance()
|
||||||
{
|
{
|
||||||
local wk=25200
|
local workDay=25200
|
||||||
local blh=$(echo ${1} | cut -d ':' -f 1)
|
local blh=$(echo ${1} | cut -d ':' -f 1 | cut -c2-)
|
||||||
local blm=$(echo ${1} | cut -d ':' -f 2)
|
local blm=$(echo ${1} | cut -d ':' -f 2)
|
||||||
local bls=""
|
local bls=$((blh*3600 + blm*60))
|
||||||
local nbls=""
|
local nbls=0
|
||||||
echo ${nbls}
|
if [ "${bls}" -le "${workDay}" ]; then
|
||||||
|
nbls=$((${2}-(workDay - bls)))
|
||||||
|
else
|
||||||
|
nbls=$((bls+${2}))
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $nbls
|
||||||
}
|
}
|
||||||
|
|
||||||
getCapitalTime()
|
getCapitalTime()
|
||||||
@ -69,9 +82,9 @@ getCapitalTime()
|
|||||||
nbl=$(getNewBalance "${sl}" "${dr}")
|
nbl=$(getNewBalance "${sl}" "${dr}")
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Your time balance is : ${sl}"
|
echo "Your time balance is: ${sl}"
|
||||||
echo "Today you worked $(s2h ${dr})"
|
echo "Today you worked $(s2h ${dr})"
|
||||||
#echo "If you validate now your balance will be : ${nbl}"
|
echo "Balance if you validate now: $(s2h ${nbl})"
|
||||||
}
|
}
|
||||||
|
|
||||||
show()
|
show()
|
||||||
|
Loading…
Reference in New Issue
Block a user