Skip to content

[Tech] Déplacement des méthodes qui concernent les statistiques vers un query service#5711

Open
emilschn wants to merge 5 commits intodevelopfrom
feature/5622-stats-query-services
Open

[Tech] Déplacement des méthodes qui concernent les statistiques vers un query service#5711
emilschn wants to merge 5 commits intodevelopfrom
feature/5622-stats-query-services

Conversation

@emilschn
Copy link
Copy Markdown
Collaborator

Ticket

#5622

Description

Déplacement des méthodes qui concernent les statistiques vers un query service

Pré-requis

make composer

Tests

  • CI Ok
  • Vérifier les stats
  • Faire un tour sur la plateforme

@emilschn emilschn force-pushed the feature/5622-stats-query-services branch from 7d01e2d to 024d946 Compare April 14, 2026 08:49
@emilschn emilschn marked this pull request as ready for review April 14, 2026 13:02
@sonarqubecloud
Copy link
Copy Markdown

@@ -0,0 +1,68 @@
<?php

namespace App\Tests\Functional\Repository\Query\Dashboard;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mettre à jour namespace, Statistics à la place Dashboard

Comment on lines +73 to +102
public function countClosed(bool $removeImported = false): int
{
$qb = $this->entityManager->createQueryBuilder()
->from(Signalement::class, 's')
->select('COUNT(s.id)')
->andWhere('s.statut = :closedStatus')
->setParameter('closedStatus', SignalementStatus::CLOSED);

if ($removeImported) {
$qb->andWhere('s.isImported IS NULL OR s.isImported = 0');
}

return (int) $qb->getQuery()->getSingleScalarResult();
}

/**
* @throws NonUniqueResultException
* @throws NoResultException
*/
public function countRefused(): int
{
$qb = $this->entityManager->createQueryBuilder()
->from(Signalement::class, 's')
->select('COUNT(s.id)')
->andWhere('s.statut = :refusedStatus')
->setParameter('refusedStatus', SignalementStatus::REFUSED)
->andWhere('s.isImported IS NULL OR s.isImported = 0');

return (int) $qb->getQuery()->getSingleScalarResult();
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait en faire une seule méthode ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants