Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Export planning - D...
 
Notifications
Clear all

Export planning - Division by zero

4 Posts
2 Users
0 Reactions
2,175 Views
(@dieperie)
Posts: 47
Active Member
Topic starter
 
[#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.


 
Posted : 31 May 2019 14H29
babynus
(@babynus)
Posts: 14966
Main Contributor 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.


 
Posted : 31 May 2019 18H26
(@dieperie)
Posts: 47
Active Member
Topic starter
 

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.


 
Posted : 01 Jun 2019 12H55
babynus
(@babynus)
Posts: 14966
Main Contributor 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


 
Posted : 01 Jun 2019 22H15
Share:

Scroll to Top