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