mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Features: apply all the filters and aggregators concerning person on accompanying courses
This commit is contained in:
parent
c1df8084a6
commit
826a975fbe
@ -101,7 +101,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
|
|||||||
->andWhere('acp.step != :count_acp_step')
|
->andWhere('acp.step != :count_acp_step')
|
||||||
->leftJoin('acp.participations', 'acppart')
|
->leftJoin('acp.participations', 'acppart')
|
||||||
->leftJoin('acppart.person', 'person')
|
->leftJoin('acppart.person', 'person')
|
||||||
->andWhere('acppart.startDate != acppart.endDate')
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->exists(
|
$qb->expr()->exists(
|
||||||
'SELECT 1 FROM ' . PersonCenterHistory::class . ' acl_count_person_history WHERE acl_count_person_history.person = person
|
'SELECT 1 FROM ' . PersonCenterHistory::class . ' acl_count_person_history WHERE acl_count_person_history.person = person
|
||||||
|
@ -16,7 +16,6 @@ use Chill\MainBundle\Export\FormatterInterface;
|
|||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
|
||||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
@ -53,7 +52,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Create an average of accompanying courses duration according to various filters';
|
return 'Create an average of accompanying courses duration of each person participation to accompanying course, according to filters on persons, accompanying course';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
@ -63,21 +62,37 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
if ('export_result' !== $key) {
|
return static function ($value) use ($key) {
|
||||||
throw new LogicException("the key {$key} is not used by this export");
|
if ('_header' === $value) {
|
||||||
}
|
switch ($key) {
|
||||||
|
case 'avg_export_result':
|
||||||
|
return 'export.export.acp_stats.avg_duration';
|
||||||
|
|
||||||
$labels = array_combine($values, $values);
|
case 'count_acppart_export_result':
|
||||||
$labels['_header'] = $this->getTitle();
|
return 'export.export.acp_stats.count_participations';
|
||||||
|
|
||||||
return static function ($value) use ($labels) {
|
case 'count_acp_export_result':
|
||||||
return $labels[$value];
|
return 'export.export.acp_stats.count_acps';
|
||||||
|
|
||||||
|
case 'count_pers_export_result':
|
||||||
|
return 'export.export.acp_stats.count_persons';
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new LogicException('key not supported: ' . $key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data): array
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['export_result'];
|
return ['avg_export_result', 'count_acp_export_result', 'count_acppart_export_result', 'count_pers_export_result'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data)
|
||||||
@ -87,7 +102,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'Accompanying courses duration';
|
return 'Accompanying courses participation duration and number of participations';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
@ -104,22 +119,28 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
|||||||
$qb = $this->repository->createQueryBuilder('acp');
|
$qb = $this->repository->createQueryBuilder('acp');
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
|
->select('AVG(
|
||||||
|
LEAST(acppart.endDate, COALESCE(acp.closingDate, :force_closingDate))
|
||||||
|
- GREATEST(acppart.startDate, COALESCE(acp.openingDate, :force_closingDate))
|
||||||
|
) AS avg_export_result')
|
||||||
|
->addSelect('COUNT(DISTINCT acppart.id) AS count_acppart_export_result')
|
||||||
|
->addSelect('COUNT(DISTINCT person.id) AS count_pers_export_result')
|
||||||
|
->addSelect('COUNT(DISTINCT acp.id) AS count_acp_export_result')
|
||||||
|
->setParameter('force_closingDate', $data['closingdate'])
|
||||||
|
->leftJoin('acp.participations', 'acppart')
|
||||||
|
->leftJoin('acppart.person', 'person')
|
||||||
|
->andWhere('acp.step != :count_acp_step')
|
||||||
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->exists(
|
$qb->expr()->exists(
|
||||||
'SELECT 1 FROM ' . AccompanyingPeriodParticipation::class . ' acl_count_part
|
'SELECT 1 FROM ' . PersonCenterHistory::class . ' acl_count_person_history WHERE acl_count_person_history.person = person
|
||||||
JOIN ' . PersonCenterHistory::class . ' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
|
||||||
'
|
'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT)
|
||||||
->setParameter('authorized_centers', $centers);
|
->setParameter('authorized_centers', $centers);
|
||||||
|
|
||||||
$qb
|
|
||||||
->select('AVG(
|
|
||||||
COALESCE(acp.closingDate, :force_closingDate) - acp.openingDate
|
|
||||||
) AS export_result')
|
|
||||||
->setParameter('force_closingDate', $data['closingdate']);
|
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +153,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Declarations::ACP_TYPE,
|
Declarations::ACP_TYPE,
|
||||||
|
Declarations::PERSON_TYPE,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,8 +359,8 @@ Count people participating in an accompanying course by various parameters.: Com
|
|||||||
Exports of accompanying courses: Exports des parcours d'accompagnement
|
Exports of accompanying courses: Exports des parcours d'accompagnement
|
||||||
Count accompanying courses: Nombre de parcours
|
Count accompanying courses: Nombre de parcours
|
||||||
Count accompanying courses by various parameters: Compte le nombre de parcours en fonction de différents filtres.
|
Count accompanying courses by various parameters: Compte le nombre de parcours en fonction de différents filtres.
|
||||||
Accompanying courses duration: Durée moyenne des parcours
|
Accompanying courses participation duration and number of participations: Durée moyenne et nombre des participation des usagers aux parcours
|
||||||
Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours en jours, selon différents filtres.
|
Create an average of accompanying courses duration of each person participation to accompanying course, according to filters on persons, accompanying course: Crée un rapport qui comptabilise la moyenne de la durée de participation de chaque usager concerné aux parcours, avec différents filtres, notamment sur les usagers concernés.
|
||||||
Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré
|
Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré
|
||||||
|
|
||||||
Exports of social work actions: Exports des actions d'accompagnement
|
Exports of social work actions: Exports des actions d'accompagnement
|
||||||
@ -989,6 +989,12 @@ notification:
|
|||||||
Notify any: Notifier d'autres utilisateurs
|
Notify any: Notifier d'autres utilisateurs
|
||||||
|
|
||||||
export:
|
export:
|
||||||
|
export:
|
||||||
|
acp_stats:
|
||||||
|
avg_duration: Moyenne de la durée de participation de chaque usager concerné
|
||||||
|
count_participations: Nombre de participations distinctes
|
||||||
|
count_persons: Nombre d'usagers concernés distincts
|
||||||
|
count_acps: Nombre de parcours distincts
|
||||||
aggregator:
|
aggregator:
|
||||||
course:
|
course:
|
||||||
by_referrer:
|
by_referrer:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user