fix: correctly update staffing status
This commit is contained in:
@@ -138,6 +138,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
public function updateStaffingStatus(): void
|
||||
{
|
||||
$confirmedDispositions = $this->getConfirmedDispositions();
|
||||
$validDispositions = $this->getValidDispositions();
|
||||
$validApplications = $this->getValidApplications();
|
||||
|
||||
// all available dispositions are taken by confirmed dispositions => staffed
|
||||
@@ -155,15 +156,18 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
return;
|
||||
}
|
||||
|
||||
// all slots are open but there are valid applications => staffing
|
||||
if (0 === $confirmedDispositions->count() && 0 < $validApplications->count()) {
|
||||
// all slots are open but there are valid applications and/or pending dispositions => staffing
|
||||
if (
|
||||
0 === $confirmedDispositions->count()
|
||||
&& (0 < $validApplications->count() || 0 < $validDispositions->count())
|
||||
) {
|
||||
$this->setStaffingStatus(Assignment::STATUS_STAFFING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// all slots are open and there are no valid applications => un-staffed
|
||||
if (0 === $this->getConfirmedDispositions()->count() && 0 === $this->getValidApplications()->count()) {
|
||||
if (0 === $confirmedDispositions->count() && 0 === $validApplications->count()) {
|
||||
$this->setStaffingStatus(Assignment::STATUS_UNSTAFFED);
|
||||
}
|
||||
}
|
||||
@@ -466,7 +470,6 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
return true === in_array($disposition->getStatus(), [
|
||||
Disposition::STATUS_NEW,
|
||||
Disposition::STATUS_CHECKING_CONTRACT,
|
||||
Disposition::STATUS_CONFIRMED,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user