-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 11593-larastan-call-to-function-always
- Loading branch information
Showing
5 changed files
with
109 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
api/database/migrations/2024_09_25_171307_rename_exec_job_title_key.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
DB::table('generic_job_titles') | ||
->where('key', 'EXECUTIVE_EX03') | ||
->update(['key' => 'DIGITAL_LEADER_EX_03']); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
DB::table('generic_job_titles') | ||
->where('key', 'DIGITAL_LEADER_EX_03') | ||
->update(['key' => 'EXECUTIVE_EX03']); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,11 @@ | |
|
||
use App\Enums\ApplicationStep; | ||
use App\Enums\ArmedForcesStatus; | ||
use App\Enums\CandidateRemovalReason; | ||
use App\Enums\CitizenshipStatus; | ||
use App\Enums\ClaimVerificationResult; | ||
use App\Enums\PoolCandidateStatus; | ||
use App\Models\Department; | ||
use App\Models\Pool; | ||
use App\Models\PoolCandidate; | ||
use App\Models\User; | ||
|
@@ -40,7 +43,14 @@ public function run() | |
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::QUALIFIED_AVAILABLE, now()->addYears(2)); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::PLACED_INDETERMINATE->name, | ||
expiryDate: now()->addYears(2), | ||
priorityStatus: ClaimVerificationResult::ACCEPTED->name, | ||
priorityExpiry: now()->addYears(2), | ||
placedAt: now()->subDays(2), | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Perfect', | ||
|
@@ -57,7 +67,12 @@ public function run() | |
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::QUALIFIED_AVAILABLE, now()->addYears(2)); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::QUALIFIED_AVAILABLE->name, | ||
expiryDate: now()->addYears(2), | ||
veteranStatus: ClaimVerificationResult::UNVERIFIED->name, | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Entry-level', | ||
|
@@ -73,23 +88,33 @@ public function run() | |
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::PLACED_TENTATIVE, now()->addYears(2)); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::PLACED_TENTATIVE->name, | ||
expiryDate: now()->addYears(2), | ||
veteranStatus: ClaimVerificationResult::REJECTED->name, | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Assertive', | ||
'last_name' => 'Non-veteran', | ||
'email' => '[email protected]', | ||
'sub' => '[email protected]', | ||
'citizenship' => CitizenshipStatus::PERMANENT_RESIDENT->name, | ||
'armed_forces_status' => ArmedForcesStatus::NON_CAF->name, | ||
'armed_forces_status' => ArmedForcesStatus::VETERAN->name, | ||
]); | ||
|
||
// 4 - Absent Canadian | ||
User::factory() | ||
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::REMOVED); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::REMOVED->name, | ||
removalReason: CandidateRemovalReason::NOT_RESPONSIVE->name, | ||
expiryDate: now()->addYears(2), | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Absent', | ||
|
@@ -104,7 +129,11 @@ public function run() | |
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::QUALIFIED_AVAILABLE, now()->addYears(2)); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::SCREENED_OUT_APPLICATION->name, | ||
expiryDate: now()->addYears(2), | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Screened-out', | ||
|
@@ -119,7 +148,12 @@ public function run() | |
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::QUALIFIED_AVAILABLE, now()->addYears(2)); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::REMOVED->name, | ||
removalReason: CandidateRemovalReason::OTHER->name, | ||
expiryDate: now()->addYears(2), | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Failed', | ||
|
@@ -134,7 +168,11 @@ public function run() | |
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::QUALIFIED_AVAILABLE, now()->addYears(2)); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::QUALIFIED_AVAILABLE->name, | ||
expiryDate: now()->addYears(2), | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Entry-level', | ||
|
@@ -149,7 +187,12 @@ public function run() | |
->asApplicant() | ||
->withSkillsAndExperiences() | ||
->afterCreating(function (User $user) { | ||
$this->applyToAllPools($user, PoolCandidateStatus::SCREENED_OUT_ASSESSMENT); | ||
$this->applyToAllPools( | ||
user: $user, | ||
status: PoolCandidateStatus::SCREENED_OUT_ASSESSMENT->name, | ||
priorityStatus: ClaimVerificationResult::UNVERIFIED->name, | ||
expiryDate: now()->addYears(2), | ||
); | ||
}) | ||
->create([ | ||
'first_name' => 'Unsuccessful', | ||
|
@@ -158,25 +201,47 @@ public function run() | |
'sub' => '[email protected]', | ||
'citizenship' => CitizenshipStatus::CITIZEN->name, | ||
]); | ||
|
||
} | ||
|
||
private function applyToAllPools($user, $status, $expiryDate = null, $placedDepartmentId = null) | ||
private function applyToAllPools( | ||
$user, | ||
$status, | ||
$removalReason = null, | ||
$expiryDate = null, | ||
$priorityStatus = null, | ||
$priorityExpiry = null, | ||
$veteranStatus = null, | ||
$veteranExpiry = null, | ||
$placedAt = null) | ||
{ | ||
foreach ($this->publishedPools as $pool) { | ||
// create a pool candidate in the pool | ||
PoolCandidate::factory()->for($user)->for($pool) | ||
->afterCreating(function (PoolCandidate $candidate) { | ||
->afterCreating(function (PoolCandidate $candidate) use ($removalReason, $placedAt, $priorityStatus, $priorityExpiry, $veteranStatus, $veteranExpiry) { | ||
if ($removalReason == CandidateRemovalReason::OTHER->name) { | ||
$candidate->removal_reason_other = 'Other reason'; | ||
} else { | ||
$candidate->removal_reason_other = null; | ||
} | ||
$candidate->priority_verification = $priorityStatus; | ||
$candidate->priority_verification_expiry = $priorityExpiry; | ||
$candidate->veteran_verification = $veteranStatus; | ||
$candidate->veteran_verification_expiry = $veteranExpiry; | ||
$candidate->placed_department_id = isset($placedAt) ? | ||
Department::inRandomOrder()->first()->id : null; | ||
|
||
$candidate->save(); | ||
$candidate->setApplicationSnapshot(); | ||
}) | ||
->create([ | ||
'pool_id' => $pool->id, | ||
'user_id' => $user->id, | ||
'submitted_at' => config('constants.far_past_date'), | ||
'submitted_steps' => array_column(ApplicationStep::cases(), 'name'), | ||
'pool_candidate_status' => $status->name, | ||
'pool_candidate_status' => $status, | ||
'removal_reason' => $removalReason, | ||
'expiry_date' => $expiryDate, | ||
'placed_department_id' => $placedDepartmentId, | ||
'placed_at' => $placedAt, | ||
]); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters