/** * This function returns the total amount of seconds worked in this task * * @return integer */ function getTotalSeconds() { $totalSeconds = Timeslots::getTotalSecondsWorkedOnObject($this->getId()); return $totalSeconds; }
function calculatePercentComplete() { if (!$this->isCompleted() && $this->getTimeEstimate() > 0) { $total_time = 0; $totalSeconds = Timeslots::getTotalSecondsWorkedOnObject($this->getId()); $total_percentComplete = round($totalSeconds * 100 / ($this->getTimeEstimate() * 60)); if ($total_percentComplete < 0) { $total_percentComplete = 0; } $this->setPercentCompleted($total_percentComplete); $this->save(); } }