Example #1
0
 public function testgetAllProjectTasks()
 {
     $project = new Project();
     $project->id = 1;
     $result = $project->getAllProjectTasks();
     $this->assertTrue(is_array($result));
 }
Example #2
0
 public function updateParentProjectTaskPercentage()
 {
     if (empty($this->parent_task_id)) {
         return;
     }
     $projectId = $this->project_id;
     if (!empty($projectId)) {
         $project = new Project();
         $project->retrieve($projectId);
         $projectTasks = $project->getAllProjectTasks();
         $dependentTaskId = $this->parent_task_id;
         $collectPercentage = 0;
         $parentProjectTask = false;
         foreach ($projectTasks as $key => $value) {
             if ($value->project_task_id == $dependentTaskId) {
                 $parentProjectTask = $value;
                 continue;
             }
             $collectPercentage += $value->percent_complete;
         }
         if ($parentProjectTask) {
             $parentProjectTask->percent_complete = round($collectPercentage / (count($projectTasks) - 1));
             $parentProjectTask->save(isset($GLOBALS['check_notify']) ? $GLOBALS['check_notify'] : '');
         }
     }
 }