correct bug: tunits below 1.0 were interpreted as octal!

This commit is contained in:
Yargo 2021-09-09 17:38:35 +02:00
parent a5a73dd773
commit ffcd6135f8
1 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
# clikan.sh -- CLI Kanban
ver='2021-08-26/HB9KNS'
ver='2021-09-09/HB9KNS'
conf="${CLIKANCONF:-$HOME/.clikanconf}"
defkanban="$HOME/clikanban.md"
@ -363,8 +363,11 @@ p) echo "## planning for $planpart% of $tunits $planunit"
fi
# get estimated units for task, append '.0' to force decimal notation,
# remove dot, keep one decimal and truncate additional figures
# (i.e multiply by 10)
tunits=`echo "$task" | sed -e "s/.*$tepatt.*/\2/;s/$/.0/;s/[.]\([0-9]\).*/\1/"`
# (i.e multiply by 10), remove leading 0s
# TODO: following 2 lines are really ugly, should be simplified...
tunits=`echo "$task" | sed -e "s/.*$tepatt.*/\2/;s/$/.0/;s/[.]\([0-9]\).*/\1/;s/^0*//"`
# if empty, set to 0
tunits=${tunits:-0}
# assign 2*weight/8*tunits/days per task, but not more than estimated units
tcap=$(( $w8/4*$tunits/$td ))
if test $tcap -gt $tunits