Merge remote-tracking branch 'origin/master' into issue714_eval_time_spent

This commit is contained in:
2023-03-24 17:51:37 +01:00
158 changed files with 2482 additions and 797 deletions

View File

@@ -680,6 +680,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
$this->proxyAccompanyingPeriodOpenState = false;
}
public function countResources(): int
{
return $this->resources->count();
}
/**
* This public function is the same but return only true or false.
*/
@@ -764,6 +769,18 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $result;
}
public function countAccompanyingPeriodInvolved(
bool $asParticipantOpen = true,
bool $asRequestor = true
): int {
// TODO should be optimized to avoid loading accompanying period ?
return $this->getAccompanyingPeriodInvolved($asParticipantOpen, $asRequestor)
->filter(function (AccompanyingPeriod $p) {
return $p->getStep() !== AccompanyingPeriod::STEP_DRAFT;
})
->count();
}
/**
* Get AccompanyingPeriodParticipations Collection.
*