Author Topic: Probem with "percentage completed" in tasks  (Read 8166 times)

illya

  • Newbie
  • *
  • Posts: 3
    • View Profile
Probem with "percentage completed" in tasks
« on: April 08, 2013, 11:12:55 am »
Hi,

I believe it's kinda bug. There is a problem with Percent Completed in tasks. For example I can create a new task and set Percents Completed value to 50. In overview I'll see 50% done in percentage color bar. But if I try to edit and save this task setting any other value in Percents Completed field, I would see 0 % done in overview.

The bug is fully replicatable on Feng Office CE 2.2.4 and 2.2.4.1
« Last Edit: April 08, 2013, 04:15:50 pm by illya »

franponce87

  • Administrator
  • Hero Member
  • *****
  • Posts: 1819
    • View Profile
    • Email
Re: Probem with "percentage completed" in tasks
« Reply #1 on: April 09, 2013, 11:58:25 am »
Actually, this has already been solved for the Professional Edition, so should you have such version you may contact your Account Executive to get the latest one available, and in case you are using the Community Edition you would have to wait until the next version is available - we still have no release date -.

Best regards,
Francisco
Would you like to install Feng Office Professional or Enterprise Edition in your servers? No problem! Read this article!

sosamv

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Probem with "percentage completed" in tasks
« Reply #2 on: April 11, 2013, 08:46:31 pm »
It is actually pretty simple to fix but hard to find. Look for the file called ProjectTask.class.php, locate the calculatePercentComplete function and repleace it with this one: 

Code: [Select]
function calculatePercentComplete() {
if ($this->getTimeEstimate() > 0){
$all_timeslots = $this->getTimeslots();
$total_time = 0;
foreach ($all_timeslots as $ts) {
if (!$ts->getEndTime() instanceof DateTimeValue) continue;
$total_time += ($ts->getEndTime()->getTimestamp() - ($ts->getStartTime()->getTimestamp() + $ts->getSubtract())) / 3600;
}
$total_percentComplete = round(($total_time * 100) / ($this->getTimeEstimate() / 60));
if ($total_percentComplete < 0) $total_percentComplete = 0;
}
$this->setPercentCompleted($this->getPercentCompleted());
$this->save();
}

Dont know if its the right way to solve it, at least it doesnt breaks anything and when you enter an estimate it will still work

 ;)

sosamv

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Probem with "percentage completed" in tasks
« Reply #3 on: April 11, 2013, 08:54:17 pm »
Mde a mistake, it works tho, but this one works better:

Code: [Select]
function calculatePercentComplete() {
if ($this->getTimeEstimate() > 0){
$all_timeslots = $this->getTimeslots();
$total_time = 0;
foreach ($all_timeslots as $ts) {
if (!$ts->getEndTime() instanceof DateTimeValue) continue;
$total_time += ($ts->getEndTime()->getTimestamp() - ($ts->getStartTime()->getTimestamp() + $ts->getSubtract())) / 3600;
}
$total_percentComplete = round(($total_time * 100) / ($this->getTimeEstimate() / 60));
if ($total_percentComplete < 0) $total_percentComplete = 0;
                }else{
                    $total_percentComplete = $this->getPercentCompleted();
                }
$this->setPercentCompleted($total_percentComplete);
$this->save();
}


zoeselina

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Probem with "percentage completed" in tasks
« Reply #4 on: April 30, 2013, 08:19:15 am »
Thank you! I was having this problem too, and your fix solved it.  ;D

garzy

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Probem with "percentage completed" in tasks
« Reply #5 on: February 11, 2015, 03:45:43 pm »
How when this fix will be included in the latest fengoffice releases (3.0.6)?. After few years now today the percentage completed are yet being calculating wrong...

franponce87

  • Administrator
  • Hero Member
  • *****
  • Posts: 1819
    • View Profile
    • Email
Re: Probem with "percentage completed" in tasks
« Reply #6 on: March 19, 2015, 11:34:45 am »
How when this fix will be included in the latest fengoffice releases (3.0.6)?. After few years now today the percentage completed are yet being calculating wrong...

I am afraid I cannot reproduce this problem at all since a while back.

Have you reported it in here? In case you could let us know step by step how you get to it, that would be appreciated.

Best regards,
Francisco
Would you like to install Feng Office Professional or Enterprise Edition in your servers? No problem! Read this article!