Adding possible clockout times
This commit is contained in:
parent
f7ebc0409f
commit
7800235bd1
29
badgy
29
badgy
@ -54,6 +54,24 @@ getNewBalance()
|
||||
echo $nbls
|
||||
}
|
||||
|
||||
getClockOutTime()
|
||||
{
|
||||
local workDay=25200
|
||||
local dr=${1}
|
||||
local now=$(date +'%s')
|
||||
local remaining=$((workDay - dr))
|
||||
local endingTime=$((now + remaining))
|
||||
date -d @${endingTime} +'%H:%M'
|
||||
}
|
||||
|
||||
captitalTime2seconds()
|
||||
{
|
||||
cph=$(echo "${1}" | awk -F ':' '{gsub("+|-",""); print $1}' )
|
||||
cpm=$(echo "${1}" | awk -F ':' '{gsub("+|-",""); print $2}' )
|
||||
sign=${1::1}
|
||||
echo ${sign}$(( (cphd*3600)+(cpm*60)))
|
||||
}
|
||||
|
||||
getCapitalTime()
|
||||
{
|
||||
data=$(${CURLIE} POST ${BADGEURL}/showtimers key=${KEY} dateof=$(date +'%Y-%m-%d') 2> /dev/null)
|
||||
@ -83,13 +101,16 @@ getCapitalTime()
|
||||
done
|
||||
|
||||
nbl=$(getNewBalance "${sl}" "${dr}")
|
||||
|
||||
echo
|
||||
balance=$(captitalTime2seconds "${sl}")
|
||||
clockOutTime=$(getClockOutTime "$((dr+balance))")
|
||||
echo
|
||||
echo "Your time balance is: ${sl}"
|
||||
echo "Today you worked: $(s2h ${dr})"
|
||||
echo
|
||||
echo "Balance if you validate now: $(s2h ${nbl})"
|
||||
echo "Today you worked: $(s2h ${dr})"
|
||||
echo
|
||||
echo "Balance if you validate now : $(s2h ${nbl})"
|
||||
echo "Clockout time (use balance) : ${clockOutTime}"
|
||||
echo "Clockout time (keep balance) : $(getClockOutTime "${dr}")"
|
||||
}
|
||||
|
||||
show()
|
||||
|
Loading…
Reference in New Issue
Block a user