Skip to content

Commit

Permalink
impact multi ter #3307
Browse files Browse the repository at this point in the history
  • Loading branch information
numew committed Dec 10, 2024
1 parent 213759a commit 164cc6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Repository/SignalementRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ public function findSignalementsBetweenDates(\DateTimeImmutable $startDate, \Dat

public function findForAPI(User $user, int $limit = 1, int $page = 1, ?string $uuid = null, ?string $reference = null): array
{
$partner = $user->getPartner(); // TODO : impact multi territoire
$partners = $user->getPartners();
$offset = ($page - 1) * $limit;
$qb = $this->createQueryBuilder('s')
->select('s', 'desordrePrecisions', 'desordreCategories', 'desordreCriteres', 'signalementQualifications',
Expand All @@ -1405,8 +1405,8 @@ public function findForAPI(User $user, int $limit = 1, int $page = 1, ?string $u
->leftJoin('s.affectations', 'affectations')
->leftJoin('s.interventions', 'interventions')
->leftJoin('s.territory', 'territory')
->where('affectations.partner = :partner')
->setParameter('partner', $partner)
->where('affectations.partner IN (:partners)')
->setParameter('partners', $partners)
->orderBy('s.createdAt', 'DESC')
->setFirstResult($offset)
->setMaxResults($limit);
Expand Down
12 changes: 6 additions & 6 deletions tests/Functional/Controller/Back/BackUserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public function provideParamsUserList(): iterable
{
yield 'Search without params' => [[], 57];
yield 'Search with queryUser admin' => [['queryUser' => 'admin'], 21];
yield 'Search with territory 13' => [['territory' => 13], 10];
yield 'Search with territory 13' => [['territory' => 13], 11];
yield 'Search with territory 13 and partner 6 and 7' => [['territory' => 13, 'partners' => [6, 7]], 2];
yield 'Search with status 0' => [['statut' => 0], 8];
yield 'Search with role ROLE_ADMIN' => [['role' => 'ROLE_ADMIN'], 3];
yield 'Search with role ROLE_ADMIN and territory 13' => [['role' => 'ROLE_ADMIN', 'territory' => 13], 0];
yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 8];
yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 9];
yield 'Search with territory 13 and partnerType Ars' => [['territory' => 13, 'partnerType' => 'ARS'], 1];
}

Expand All @@ -67,13 +67,13 @@ public function testUserExport(array $params, int $nb): void

public function provideParamsUserExport(): iterable
{
yield 'Search without params' => [[], 10];
yield 'Search without params' => [[], 11];
yield 'Search with queryUser user' => [['queryUser' => 'user'], 6];
yield 'Search with partner 6 and 7' => [['partners' => [2]], 4];
yield 'Search with status 1' => [['statut' => 1], 8];
yield 'Search with partner 6 and 7' => [['partners' => [2]], 5];
yield 'Search with status 1' => [['statut' => 1], 9];
yield 'Search with role ROLE_USER_PARTNER' => [['role' => 'ROLE_USER_PARTNER'], 6];
yield 'Search with role ROLE_USER_PARTNER and status 1' => [['role' => 'ROLE_USER_PARTNER', 'statut' => 1], 4];
yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 10];
yield 'Search with territory 13 and partnerType Autre' => [['territory' => 13, 'partnerType' => 'AUTRE'], 11];
yield 'Search with partnerType Ars' => [['partnerType' => 'ARS'], 1];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testNotifyVisiteToConclude()
$intervention = $signalement->getInterventions()[0];

$nbNotified = $this->visiteNotifier->notifyVisiteToConclude($intervention);
$this->assertEquals($nbNotified, 4);
$this->assertEquals($nbNotified, 5);
}

public function testNotifyVisiteToConclude69()
Expand Down

0 comments on commit 164cc6b

Please sign in to comment.