Skip to content

Commit

Permalink
Add Final decision column to CSV with ROD data (#12192)
Browse files Browse the repository at this point in the history
* Add 'Final decision' column to pool candidate csv

* Translation fix
  • Loading branch information
JamesHuf authored Dec 6, 2024
1 parent ac6549d commit e939389
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
37 changes: 37 additions & 0 deletions api/app/Generators/PoolCandidateCsvGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -54,6 +56,8 @@ class PoolCandidateCsvGenerator extends CsvGenerator implements FileGeneratorInt

protected array $RODData = [];

protected array $finalDecisions = [];

protected array $generatedHeaders = [
'general_questions' => [],
'screening_questions' => [],
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -398,6 +428,7 @@ private function generatePoolHeaders()
);
}
}
$this->generatedHeaders['ROD_details'][] = $this->localizeHeading('final_decision');
}
}
});
Expand Down Expand Up @@ -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']);
}
}
}

}
Expand Down
1 change: 1 addition & 0 deletions api/lang/en/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
'not_sure' => 'Not sure',
'expected_end_date' => '(Expected end date)',
'not_found' => 'Not found',
'step' => 'Step',
];
1 change: 1 addition & 0 deletions api/lang/en/headings.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@
'decision' => 'Decision',
'decision_details' => 'Decision details',
'decision_notes' => 'Decision notes',
'final_decision' => 'Final decision',
];
1 change: 1 addition & 0 deletions api/lang/fr/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
'not_sure' => 'Pas certain',
'expected_end_date' => '(Date de fin prévue)',
'not_found' => 'Introuvable',
'step' => 'Étape',
];
1 change: 1 addition & 0 deletions api/lang/fr/headings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

0 comments on commit e939389

Please sign in to comment.