Skip to content

Commit

Permalink
chore: use cached value
Browse files Browse the repository at this point in the history
  • Loading branch information
maelgangloff committed Aug 22, 2024
1 parent a0a9bcd commit 52efac8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Controller/StatisticsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ public function __invoke(): Statistics
->setDomainPurchased($this->pool->getItem('stats.domain.purchased')->get() ?? 0)
->setDomainPurchaseFailed($this->pool->getItem('stats.domain.purchase.failed')->get() ?? 0)
->setAlertSent($this->pool->getItem('stats.alert.sent')->get() ?? 0)

->setDomainTracked(
$this->watchListRepository->createQueryBuilder('w')
$this->getCachedItem('stats.domain.tracked', fn () => $this->watchListRepository->createQueryBuilder('w')
->join('w.domains', 'd')
->select('COUNT(DISTINCT d.ldhName)')
->where('d.deleted = FALSE')
->getQuery()->getSingleColumnResult()[0]
->getQuery()->getSingleColumnResult()[0])
)
->setDomainCount(
$this->getCachedItem('stats.domain.count', fn () => $this->domainRepository->createQueryBuilder('d')
Expand Down

0 comments on commit 52efac8

Please sign in to comment.