Skip to content

Commit

Permalink
Fix VisitIterationRepositoryTest for MS SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Apr 13, 2024
1 parent f0e6200 commit 82e7094
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions module/Core/src/Visit/Repository/VisitIterationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public function findAllVisits(?DateRange $dateRange = null, int $blockSize = sel
{
$qb = $this->createQueryBuilder('v');
if ($dateRange?->startDate !== null) {
$qb->andWhere($qb->expr()->gte('v.date', ':since'));
$qb->setParameter('since', $dateRange->startDate, ChronosDateTimeType::CHRONOS_DATETIME);
$qb->andWhere($qb->expr()->gte('v.date', ':since'))
->setParameter('since', $dateRange->startDate, ChronosDateTimeType::CHRONOS_DATETIME);
}
if ($dateRange?->endDate !== null) {
$qb->andWhere($qb->expr()->lte('v.date', ':until'));
$qb->setParameter('until', $dateRange->endDate, ChronosDateTimeType::CHRONOS_DATETIME);
$qb->andWhere($qb->expr()->lte('v.date', ':until'))
->setParameter('until', $dateRange->endDate, ChronosDateTimeType::CHRONOS_DATETIME);
}

return $this->visitsIterableForQuery($qb, $blockSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ public function findVisitsReturnsProperVisits(int $blockSize): void
$unlocated = $this->repo->findUnlocatedVisits($blockSize);
$all = $this->repo->findAllVisits(blockSize: $blockSize);
$lastThreeDays = $this->repo->findAllVisits(
dateRange: DateRange::since(Chronos::now()->subDays(2)),
dateRange: DateRange::since(Chronos::now()->subDays(2)->startOfDay()),
blockSize: $blockSize,
);
$firstTwoDays = $this->repo->findAllVisits(
dateRange: DateRange::until(Chronos::now()->subDays(4)),
dateRange: DateRange::until(Chronos::now()->subDays(4)->endOfDay()),
blockSize: $blockSize,
);
$daysInBetween = $this->repo->findAllVisits(
dateRange: DateRange::between(
startDate: Chronos::now()->subDays(5),
endDate: Chronos::now()->subDays(2),
startDate: Chronos::now()->subDays(5)->startOfDay(),
endDate: Chronos::now()->subDays(2)->endOfDay(),
),
blockSize: $blockSize,
);
Expand Down

0 comments on commit 82e7094

Please sign in to comment.