mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
fix test which randomly failed
This commit is contained in:
@@ -1264,15 +1264,24 @@ class Person implements HasCenterInterface
|
||||
}
|
||||
|
||||
public function getCurrentHousehold(?\DateTimeImmutable $at = null): ?Household
|
||||
{
|
||||
$participation = $this->getCurrentHouseholdParticipationShareHousehold($at);
|
||||
|
||||
return $participation instanceof HouseholdMember ?
|
||||
$participation->getHousehold()
|
||||
: null;
|
||||
}
|
||||
|
||||
public function getCurrentHouseholdParticipationShareHousehold(?\DateTimeImmutable $at = null): ?HouseholdMember
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$expr = Criteria::expr();
|
||||
$date = NULL === $at ? new \DateTimeImmutable('now') : $at;
|
||||
$date = NULL === $at ? new \DateTimeImmutable('today') : $at;
|
||||
$datef = $date->format('Y-m-d');
|
||||
|
||||
if (
|
||||
NULL !== ($this->currentHouseholdAt[$datef] ?? NULL)) {
|
||||
return $this->currentHouseholdAt[$datef];
|
||||
NULL !== ($this->currentHouseholdParticipationAt[$datef] ?? NULL)) {
|
||||
return $this->currentHouseholdParticipationAt[$datef];
|
||||
}
|
||||
|
||||
$criteria
|
||||
@@ -1281,7 +1290,7 @@ class Person implements HasCenterInterface
|
||||
$expr->lte('startDate', $date),
|
||||
$expr->orX(
|
||||
$expr->isNull('endDate'),
|
||||
$expr->gte('endDate', $date)
|
||||
$expr->gt('endDate', $date)
|
||||
),
|
||||
$expr->eq('shareHousehold', true)
|
||||
)
|
||||
@@ -1292,8 +1301,7 @@ class Person implements HasCenterInterface
|
||||
;
|
||||
|
||||
return $participations->count() > 0 ?
|
||||
$this->currentHouseholdAt[$datef] = $participations->first()
|
||||
->getHousehold()
|
||||
$this->currentHouseholdParticipationAt[$datef] = $participations->first()
|
||||
: null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user