/**
  * @authorize
  * @method GET
  * @customRoute('projects/int/config')
  */
 public function getActiveConfig($projectId)
 {
     TestCasesRepository::getInstance()->clearRemainingTestCasesOnDayEnd();
     ConfigurationRepository::getInstance()->updateParkedConfigurations();
     $activeConfig = ConfigurationRepository::getInstance()->getActiveProjectConfiguration($projectId);
     return $activeConfig;
 }
 /**
  * @authorize
  * @method GET
  * @customRoute('projects/int/allocatedDays')
  */
 public function getProjectAllocatedDaysPage($projectId)
 {
     ProjectsRepository::getInstance()->syncProjectTestCases($projectId);
     TestCasesRepository::getInstance()->clearRemainingTestCasesOnDayEnd();
     ConfigurationRepository::getInstance()->updateParkedConfigurations();
     $allocatedDays = DaysRepository::getInstance()->getProjectAssignedDays($projectId);
     return ['allocatedDays' => $allocatedDays];
 }
 /**
  * @authorize
  * @method GET
  * @customRoute('projects/int/setup')
  */
 public function getProjectSetupPage($projectId)
 {
     $config = ConfigurationRepository::getInstance()->getActiveProjectConfiguration($projectId);
     $project = ProjectsRepository::getInstance()->getProjectById($projectId);
     if (!isset($project['id'])) {
         $replicated = SetupRepository::getInstance()->replicateProject($projectId);
         if ($replicated == 0) {
             throw new ApplicationException("Project with Id {$projectId} failed to replicate", 404);
         }
         $project = ProjectsRepository::getInstance()->getProjectById($projectId);
     }
     ProjectsRepository::getInstance()->syncProjectTestCases($projectId);
     TestCasesRepository::getInstance()->clearRemainingTestCasesOnDayEnd();
     ConfigurationRepository::getInstance()->updateParkedConfigurations();
     $testCases = TestCasesRepository::getInstance()->getProjectUnallocatedTestCasesCount($projectId);
     $project['unAllocatedTestCasesCount'] = $testCases['unAllocatedTestCasesCount'];
     $project['config'] = ConfigurationRepository::getInstance()->getActiveProjectConfiguration($projectId);
     $project['activeUsers'] = ProjectsRepository::getInstance()->getProjectAssignedUsers($projectId, $config['configId']);
     $project['currentDuration'] = ProjectsRepository::getInstance()->getProjectCurrentDuration($projectId, $config['configId']);
     $project['expiredNonFinalTestCasesCount'] = TestCasesRepository::getInstance()->getProjectExpiredNonFinalTestCasesCount($projectId, $config['configId']);
     return $project;
 }
 public function stopExecution($projectId, $model, $configId)
 {
     $this->beginTran();
     $this->insertPlanChange(null, null, null, $projectId, $model->reason->id, $configId);
     TestCasesRepository::getInstance()->clearRemainingTestCases($projectId);
     $this->clearRemainingDays($projectId);
     ConfigurationRepository::getInstance()->parkConfiguration($configId);
     $this->commit();
 }
 public function clearSetup($projectId, $config, $reason)
 {
     $this->beginTran();
     DaysRepository::getInstance()->insertPlanChange(null, null, $reason->explanation, $projectId, $reason->id, $config['configId']);
     TestCasesRepository::getInstance()->clearRemainingTestCases($projectId);
     DaysRepository::getInstance()->clearRemainingDays($projectId);
     ConfigurationRepository::getInstance()->closeActiveConfiguration($config['configId']);
     $this->commit();
 }
 /**
  * @authorize
  * @method POST
  * @customRoute('projects/int/testCases/changeDate');
  */
 public function changeDate($projectId, ChangeDayBindingModel $model)
 {
     $configuration = ConfigurationRepository::getInstance()->getActiveProjectConfiguration($projectId);
     $changeResult = TestCasesRepository::getInstance()->changeTestCaseDate($model, $configuration['configId']);
     return $changeResult;
 }
 private function updateExisting($testLinkTestCases, $reportingTestCases)
 {
     foreach ($reportingTestCases as $reportingK => $reportingV) {
         foreach ($testLinkTestCases as $testLinkK => $testLinkV) {
             if ($testLinkV['nodeId'] == $reportingV['externalId'] && $testLinkV['nodeName'] != $reportingV['testCaseTitle']) {
                 TestCasesRepository::getInstance()->updateExistingTestCase($reportingV['externalId'], $testLinkV['nodeName']);
             }
         }
     }
 }