ProjeQtOr free project management software - Export planning - Division by zero - ProjeQtOr
 

Export planning - Division by zero

More
31 Mai 2019 12:29 - 31 Mai 2019 12:43 #1 by dieperie
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.
<UID>120</UID>
<TaskUID>120</TaskUID>
<ResourceUID>23</ResourceUID>
<div class="messageERROR" >ERROR : An error occurred on 2019-05-31 at 10:34:30</div><input type="hidden" id="lastSaveId" value="" /><input type="hidden" id="lastOperation" value="ERROR" /><input type="hidden" id="lastOperationStatus" value="ERROR" />

'/usr/share/projeqtor/tool/jsonPlanning.php' at line (1580)
$pct=($ass->plannedWork)?round($ass->realWork/$ass->plannedWork*100,0):0;

Thank you.
Last edit: 31 Mai 2019 12:43 by dieperie.

Please Connexion or Create an account to join the conversation.

More
31 Mai 2019 16:26 #2 by babynus
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.

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
01 Jui 2019 10:55 - 01 Jui 2019 10:57 #3 by dieperie
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.
Last edit: 01 Jui 2019 10:57 by dieperie.

Please Connexion or Create an account to join the conversation.

More
01 Jui 2019 20:15 #4 by babynus
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

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.029 seconds