コード例 #1
0
 public function updateParkedConfigurations()
 {
     $stmt = $this->getDatabaseInstance()->prepare(SelectQueries::GET_PARKED_CONFIGURATIONS);
     $stmt->execute();
     $configs = $stmt->fetchAll();
     $this->beginTran();
     foreach ($configs as $configK => $configV) {
         $newDuration = 1;
         $currentDate = new \DateTime('now', new \DateTimeZone('Asia/Qatar'));
         $parkedAt = new \DateTime($configV['parkedAt'], new \DateTimeZone('Asia/Qatar'));
         $formattedCurrent = $currentDate->format('Y-m-d');
         while ($formattedCurrent != $parkedAt->format('Y-m-d')) {
             if (!SetupRepository::getInstance()->isWeekend($parkedAt->format('Y-m-d'))) {
                 $newDuration++;
             }
             $parkedAt = $parkedAt->add(new DateInterval('P' . 1 . 'D'));
         }
         $stmt = $this->getDatabaseInstance()->prepare(UpdateQueries::UPDATE_PARKED_CONFIGURATION);
         $stmt->execute([$newDuration, $configV['configId']]);
         if (!$stmt) {
             $this->rollback();
             throw new ApplicationException(implode("\n", $stmt->getErrorInfo()), 400);
         }
     }
     $this->commit();
 }
コード例 #2
0
 public function resumeExecution($projectId, $configId)
 {
     $this->beginTran();
     $configRepo = ConfigurationRepository::getInstance();
     $activeUsers = ProjectsRepository::getInstance()->getProjectAssignedUsers($projectId, $configId);
     $configRepo->closeActiveConfiguration($configId);
     $newConfig = $configRepo->createNewConfiguration($projectId);
     SetupRepository::getInstance()->assignUsersToProject($projectId, $activeUsers, $newConfig['configId']);
     $this->commit();
 }
コード例 #3
0
 /**
  * @authorize
  * @method PUT
  * @customRoute('projects/int/extendDuration')
  */
 public function extendProjectDuration($projectId, ExtendDurationBindingModel $model)
 {
     $config = ConfigurationRepository::getInstance()->getActiveProjectConfiguration($projectId);
     $activeUsers = ProjectsRepository::getInstance()->getProjectAssignedUsers($projectId, $config['configId']);
     $expectedTCPD = SetupRepository::getInstance()->calcExpectedTCPD($activeUsers);
     DaysRepository::getInstance()->extendProjectDuration($projectId, $model, $expectedTCPD, $config);
     return ['msg' => "Project with Id {$projectId} extended successfully!"];
 }
コード例 #4
0
 /**
  * @authorize
  * @method POST
  * @customRoute('projects/int/setup/clear')
  */
 public function clearProjectSetup($projectId, ResetBindingModel $model)
 {
     $config = ConfigurationRepository::getInstance()->getActiveProjectConfiguration($projectId);
     SetupRepository::getInstance()->clearSetup($projectId, $config, $model->reason);
     return ['msg' => "Configuration reset successful for project with Id {$projectId}!"];
 }