~rkta/workinghours

17c80ac72f3d4ab937f7a21d38d246ff5b746476 — Rene Kita 1 year, 6 months ago da7346a
Fix handling of target time
1 files changed, 3 insertions(+), 3 deletions(-)

M workinghours
M workinghours => workinghours +3 -3
@@ 64,7 64,7 @@ while :; do
			week=y
			target=$2
			case ${target#[+-]} in
				*[!0-9]*|'')
				*[!0-9.]*|'')
					printf "%s\n" "$helptext" >&2;
					exit 2;
					;;


@@ 259,7 259,7 @@ newweek()
{
	[ -r "$outputfile" ] || die "File not found: $outputfile"

	if [ "$target" -eq -1 ] && [ -e "$overtimefile" ]; then
	if [ "$target" = -1 ] && [ -e "$overtimefile" ]; then
		echo "You have a overtimefile and provide target hours as -1!" >&2
		echo "Aborting!" >&2
		exit 1


@@ 318,7 318,7 @@ newweek()
		fi
	done < "${outputfile}"

	if [ "$target" -ne -1 ]; then
	if [ "$target" != -1 ]; then
		target=$(echo "$target * 3600" | bc)
		target=${target%.*} # convert to int
		lastnegativ=0