feat: respect disposition status for staffing status
This commit is contained in:
@@ -421,6 +421,13 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getConfirmedDispositions(): Collection
|
||||||
|
{
|
||||||
|
return $this->dispositions->filter(function (Disposition $disposition) {
|
||||||
|
return Disposition::STATUS_CONFIRMED === $disposition->getStatus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function getContact(): ?User
|
public function getContact(): ?User
|
||||||
{
|
{
|
||||||
return $this->contact;
|
return $this->contact;
|
||||||
@@ -483,7 +490,9 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
|
|
||||||
public function isStaffed(): bool
|
public function isStaffed(): bool
|
||||||
{
|
{
|
||||||
return $this->availableDispositions === $this->dispositions->count();
|
$confirmedDispositions = $this->getConfirmedDispositions();
|
||||||
|
|
||||||
|
return $this->availableDispositions === $confirmedDispositions->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isUnstaffed(): bool
|
public function isUnstaffed(): bool
|
||||||
@@ -493,8 +502,10 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
|
|
||||||
public function isPartlyStaffed(): bool
|
public function isPartlyStaffed(): bool
|
||||||
{
|
{
|
||||||
return $this->availableDispositions > $this->dispositions->count()
|
$confirmedDispositions = $this->getConfirmedDispositions();
|
||||||
&& 0 < $this->dispositions->count();
|
|
||||||
|
return $this->availableDispositions > $confirmedDispositions->count()
|
||||||
|
&& 0 < $confirmedDispositions->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isStaffing(): bool
|
public function isStaffing(): bool
|
||||||
|
|||||||
Reference in New Issue
Block a user