Extract DQL_EXCLUDE_INVITATIONS and NO_SNAPSHOT_MSG constants in AdminController
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,8 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
class AdminController extends AbstractController
|
||||
{
|
||||
private const DQL_STATUS_PAID = 'o.status = :paid';
|
||||
private const DQL_EXCLUDE_INVITATIONS = 'o.isInvitation = false OR o.isInvitation IS NULL';
|
||||
private const NO_SNAPSHOT_MSG = self::NO_SNAPSHOT_MSG;
|
||||
|
||||
#[Route('', name: 'app_admin_dashboard')]
|
||||
public function dashboard(EntityManagerInterface $em, #[Autowire(service: 'stats.cache')] CacheInterface $cache): Response
|
||||
@@ -50,7 +52,7 @@ class AdminController extends AbstractController
|
||||
->select('SUM(o.totalHT)')
|
||||
->from(BilletBuyer::class, 'o')
|
||||
->where(self::DQL_STATUS_PAID)
|
||||
->andWhere('o.isInvitation = false OR o.isInvitation IS NULL')
|
||||
->andWhere(self::DQL_EXCLUDE_INVITATIONS)
|
||||
->setParameter('paid', BilletBuyer::STATUS_PAID)
|
||||
->getQuery()
|
||||
->getSingleScalarResult() ?? 0);
|
||||
@@ -59,7 +61,7 @@ class AdminController extends AbstractController
|
||||
->select('COUNT(o.id)')
|
||||
->from(BilletBuyer::class, 'o')
|
||||
->where(self::DQL_STATUS_PAID)
|
||||
->andWhere('o.isInvitation = false OR o.isInvitation IS NULL')
|
||||
->andWhere(self::DQL_EXCLUDE_INVITATIONS)
|
||||
->setParameter('paid', BilletBuyer::STATUS_PAID)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
@@ -73,7 +75,7 @@ class AdminController extends AbstractController
|
||||
->join('o.event', 'e')
|
||||
->join('e.account', 'a')
|
||||
->where(self::DQL_STATUS_PAID)
|
||||
->andWhere('o.isInvitation = false OR o.isInvitation IS NULL')
|
||||
->andWhere(self::DQL_EXCLUDE_INVITATIONS)
|
||||
->setParameter('paid', BilletBuyer::STATUS_PAID)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
@@ -718,8 +720,8 @@ class AdminController extends AbstractController
|
||||
|
||||
return $this->render('admin/infra.html.twig', [
|
||||
'snapshot_missing' => true,
|
||||
'server' => $emptyServer, 'containers' => [], 'redis_global' => ['connected' => false, 'error' => 'Aucun snapshot disponible.'],
|
||||
'redis_dbs' => [], 'postgres' => ['connected' => false, 'error' => 'Aucun snapshot disponible.'], 'pgbouncer' => ['connected' => false, 'error' => 'Aucun snapshot disponible.'],
|
||||
'server' => $emptyServer, 'containers' => [], 'redis_global' => ['connected' => false, 'error' => self::NO_SNAPSHOT_MSG],
|
||||
'redis_dbs' => [], 'postgres' => ['connected' => false, 'error' => self::NO_SNAPSHOT_MSG], 'pgbouncer' => ['connected' => false, 'error' => self::NO_SNAPSHOT_MSG],
|
||||
'generated_at' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user