diff --git a/api/app/Generators/PoolCandidateCsvGenerator.php b/api/app/Generators/PoolCandidateCsvGenerator.php index a9eb147e1cb..214cb3abe3b 100644 --- a/api/app/Generators/PoolCandidateCsvGenerator.php +++ b/api/app/Generators/PoolCandidateCsvGenerator.php @@ -11,10 +11,12 @@ use App\Enums\CitizenshipStatus; use App\Enums\EstimatedLanguageAbility; use App\Enums\EvaluatedLanguageAbility; +use App\Enums\FinalDecision; use App\Enums\GovEmployeeType; use App\Enums\IndigenousCommunity; use App\Enums\Language; use App\Enums\OperationalRequirement; +use App\Enums\OverallAssessmentStatus; use App\Enums\PoolCandidateStatus; use App\Enums\PoolSkillType; use App\Enums\PriorityWeight; @@ -54,6 +56,8 @@ class PoolCandidateCsvGenerator extends CsvGenerator implements FileGeneratorInt protected array $RODData = []; + protected array $finalDecisions = []; + protected array $generatedHeaders = [ 'general_questions' => [], 'screening_questions' => [], @@ -274,6 +278,32 @@ public function generate(): self } } } + + $decision = null; + if (is_null($candidate->computed_final_decision) || $candidate->computed_final_decision === FinalDecision::TO_ASSESS->name) { + if (! isset($candidate->computed_assessment_status['overallAssessmentStatus'])) { + $decision = Lang::get('final_decision.to_assess', [], $this->lang); + } else { + if ($candidate->computed_assessment_status['overallAssessmentStatus'] === OverallAssessmentStatus::DISQUALIFIED->name) { + $decision = Lang::get('final_decision.disqualified_pending', [], $this->lang); + } elseif ($candidate->computed_assessment_status['currentStep'] === null) { + $decision = Lang::get('final_decision.qualified_pending', [], $this->lang); + } else { + $decision = Lang::get('final_decision.to_assess', [], $this->lang) + .$this->colon() + .Lang::get('common.step', [], $this->lang) + .' ' + .$candidate->computed_assessment_status['currentStep']; + } + } + } else { + $decision = $this->localizeEnum($candidate->computed_final_decision, FinalDecision::class); + } + + $this->finalDecisions[] = [ + 'candidate' => $currentCandidate, + 'value' => $decision, + ]; } // 1 is added to the key to account for the header row @@ -398,6 +428,7 @@ private function generatePoolHeaders() ); } } + $this->generatedHeaders['ROD_details'][] = $this->localizeHeading('final_decision'); } } }); @@ -448,6 +479,12 @@ private function generatePoolCells(Worksheet $sheet, int $columnCount) } } } + $currentColumn++; + if (isset($this->finalDecisions)) { + foreach ($this->finalDecisions as $row) { + $sheet->setCellValue([$currentColumn, $row['candidate'] + 1], $row['value']); + } + } } } diff --git a/api/lang/en/common.php b/api/lang/en/common.php index 4b094630e26..c29de0d4d66 100644 --- a/api/lang/en/common.php +++ b/api/lang/en/common.php @@ -21,4 +21,5 @@ 'not_sure' => 'Not sure', 'expected_end_date' => '(Expected end date)', 'not_found' => 'Not found', + 'step' => 'Step', ]; diff --git a/api/lang/en/headings.php b/api/lang/en/headings.php index 4b0405d3553..8048d9dfd1c 100644 --- a/api/lang/en/headings.php +++ b/api/lang/en/headings.php @@ -80,4 +80,5 @@ 'decision' => 'Decision', 'decision_details' => 'Decision details', 'decision_notes' => 'Decision notes', + 'final_decision' => 'Final decision', ]; diff --git a/api/lang/fr/common.php b/api/lang/fr/common.php index b94fa40a3a7..2aab12122e8 100644 --- a/api/lang/fr/common.php +++ b/api/lang/fr/common.php @@ -21,4 +21,5 @@ 'not_sure' => 'Pas certain', 'expected_end_date' => '(Date de fin prévue)', 'not_found' => 'Introuvable', + 'step' => 'Étape', ]; diff --git a/api/lang/fr/headings.php b/api/lang/fr/headings.php index 1243ba6c60f..6bedefc13d4 100644 --- a/api/lang/fr/headings.php +++ b/api/lang/fr/headings.php @@ -79,4 +79,5 @@ 'decision' => 'Décision', 'decision_details' => 'Détails de la décision', 'decision_notes' => 'Notes de décision', + 'final_decision' => 'Décision finale', ];