Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] PoolCandidate category accessor return #11679

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions api/app/Models/PoolCandidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function educationRequirementExperiences(): BelongsToMany

public function getCategoryAttribute()
{
$category = null;
$category = PriorityWeight::OTHER;

$this->loadMissing(['user' => [
'citizenship',
Expand All @@ -280,11 +280,13 @@ public function getCategoryAttribute()
$category = PriorityWeight::VETERAN;
} elseif ($this->user->citizenship === CitizenshipStatus::CITIZEN->name || $this->user->citizenship === CitizenshipStatus::PERMANENT_RESIDENT->name) {
$category = PriorityWeight::CITIZEN_OR_PERMANENT_RESIDENT;
} else {
$category = PriorityWeight::OTHER;
}

return $category;
return [
'weight' => $category->weight($category->name),
'value' => $category->name,
'label' => PriorityWeight::localizedString($category->name),
];
}

public static function scopeQualifiedStreams(Builder $query, ?array $streams): Builder
Expand Down
Loading