tblancher's timetracker timekeeping system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
1.1 KiB

#!/bin/zsh
PATH=/Users/tblancher/bin:/Users/tblancher/homebrew/opt/coreutils/libexec/gnubin:/usr/bin:/bin
[[ "${1}" == "-i" ]] && IGNORE_DO_PROCESS=1 && shift
WK_OFFSET=$1
WK_TOTAL=0
[[ -z ${WK_OFFSET} ]] && WK_OFFSET=0
DATE=$(date -d "last Monday - ${WK_OFFSET} weeks")
for date in $(date +%F -d "${DATE}") \
$(date +%F -d "${DATE} + 1 day") \
$(date +%F -d "${DATE} + 2 day") \
$(date +%F -d "${DATE} + 3 day") \
$(date +%F -d "${DATE} + 4 day") \
$(date +%F -d "${DATE} + 5 day") \
$(date +%F -d "${DATE} + 6 day"); do
echo $date
if [[ -f ${date}.log ]]; then
[[ -n $IGNORE_DO_PROCESS ]] || ./do_process.sh ${date}.log | less
daily_total=$(./do_process.sh ${date}.log | grep -P "Grand total:" | grep -Po "\d+\.\d+")
if [[ ${daily_total} -gt 24 ]]; then
daily_total=24.00
fi
else
daily_total=0
fi
echo ${daily_total}
echo
#echo -n Press ENTER for ${date}...
#read
WK_TOTAL=$(bc <<< "scale=2; $WK_TOTAL + $daily_total")
done
echo "Weekly Total: ${WK_TOTAL}"