Forum

Export planning - D...
 
Notifications
Retirer tout

Export planning - Division by zero

4 Posts
2 Utilisateurs
0 Reactions
2,153 Vu
(@dieperie)
Posts: 47
Active Member
Début du sujet
 
[#6022]

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

ERROR : An error occurred on 2019-05-31 at 10:34:30

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

Thank you.


 
Posté : 31 Mai PM 14:055
(@babynus)
Posts: 14952
Membre Admin
 

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.


 
Posté : 31 Mai PM 18:055
(@dieperie)
Posts: 47
Active Member
Début du sujet
 

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.


 
Posté : 1 Juin PM 12:066
(@babynus)
Posts: 14952
Membre Admin
 

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


 
Posté : 1 Juin PM 22:066
Share:
Retour en haut