WIP: Improve assignment information display

This commit is contained in:
Björn Fromme
2023-10-19 15:20:44 +02:00
parent 21968b833c
commit 585f86e45f
15 changed files with 84 additions and 55 deletions
+26
View File
@@ -117,4 +117,30 @@ class Application implements TimestampableEntityInterface
return $this;
}
public function matchesPickup(): bool
{
if (0 === $pickupId = (int) $this->getAssignment()->getPickup()) {
return true;
}
$teamer = $this->getTeamer();
return $teamer->hasPickup($pickupId);
}
public function getCompletedTrainingsCount(): int
{
$count = 0;
$requiredTrainings = $this->getAssignment()->getJobProfile()->getRequiredTrainings();
$teamer = $this->getTeamer();
foreach ($requiredTrainings as $requiredTraining) {
if ($teamer->getTrainingAttendance($requiredTraining)) {
++$count;
}
}
return $count;
}
}
+1 -1
View File
@@ -172,7 +172,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
return $this;
}
public function getTotalPeriod(): ?CarbonPeriod
public function getEffectivePeriod(): ?CarbonPeriod
{
if (null !== $destination = $this->getDestination()) {
$dateFrom = $this->getDateFrom() ?? $destination->getDateFrom();