feat: exclude unavailable assignments from list for teamer

This commit is contained in:
Björn Fromme
2024-06-19 10:21:49 +02:00
parent b03f6e377a
commit 8d8d6dacd3
3 changed files with 43 additions and 2 deletions
+13
View File
@@ -350,6 +350,19 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
return $this->applications;
}
public function getApplicationByTeamer(Teamer $teamer): ?Application
{
$applications = $this->applications->filter(function (Application $application) use ($teamer) {
return $application->getTeamer() === $teamer;
});
if (0 === count($applications)) {
return null;
}
return $applications->first();
}
public function getValidApplications(): Collection
{
return $this->applications->filter(function (Application $application) {