Dears,
During planning export, the following error occurs:
2019-05-31 10:34:30.642 ** ERROR ** [V8.0.3] ERROR **
2019-05-31 10:34:30.643 ** ERROR ** [V8.0.3] on file '/usr/share/projeqtor/tool/jsonPlanning.php' at line (1580)
2019-05-31 10:34:30.643 ** ERROR ***** [V8.0.3] cause = Division by zero
The last lines from the .xml file.
120
120
23
'/usr/share/projeqtor/tool/jsonPlanning.php' at line (1580)
$pct=($ass->plannedWork)?round($ass->realWork/$ass->plannedWork*100,0):0;
Thank you.
Very strange !
It seems that you have some assignment with a plannedWork that is not null nor zero, but that gives zero when multiplicated by 100...
Can you please try and ass some debugging line before line 1580 in jsonPlanning.php, this way
debugLog("plannedWork='$ass->plannedWork'"),
$pct=($ass->plannedWork)?round($ass->realWork/$ass->plannedWork*100,0):0;
Then set
$logLevel=3;
in parameters.php and test again.
Post here resulting log file.
Thank you.
Below the log after these changes:
2019-06-01 10:51:29.604 ----- DEBUG ----- plannedWork='0'
2019-06-01 10:51:29.604 ----- DEBUG ----- plannedWork='0'
2019-06-01 10:51:29.604 ----- DEBUG ----- plannedWork='0.00000'
2019-06-01 10:51:29.605 ** ERROR ** [V8.0.4] ERROR **
2019-06-01 10:51:29.605 ** ERROR ** [V8.0.4] on file '/usr/share/projeqtor/tool/jsonPlanning.php' at line (1583)
2019-06-01 10:51:29.605 ** ERROR ***** [V8.0.4] cause = Division by zero
Note: When I patch with +0 ($pct=($ass->plannedWork+0)?round($ass->realWork/$ass->plannedWork*100,0):0;) it works correctly.
Hi,
traces confirms your fix.
I will prefer a more secured patch, that will not raise an error with a possible null value :
$pct=(floatval($ass->plannedWork))?round($ass->realWork/$ass->plannedWork*100,0):0;
Patch will be included in next version