mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
evaluations aggregators
This commit is contained in:
parent
d450f06286
commit
c05637bc72
@ -14,10 +14,23 @@ namespace Chill\PersonBundle\Export\Aggregator\EvaluationAggregators;
|
|||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use LogicException;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class ByEndDateAggregator implements AggregatorInterface
|
class ByEndDateAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
private const CHOICES = [
|
||||||
|
'by week' => 'week',
|
||||||
|
'by month' => 'month',
|
||||||
|
'by year' => 'year',
|
||||||
|
];
|
||||||
|
|
||||||
|
private const DEFAULT_CHOICE = 'year';
|
||||||
|
|
||||||
|
private TranslatorInterface $translator;
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -25,8 +38,29 @@ class ByEndDateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->addSelect('AS eval_by_end_date_aggregator')
|
switch ($data['frequency']) {
|
||||||
->addGroupBy('eval_by_end_date_aggregator');
|
case 'week':
|
||||||
|
$fmt = 'YYYY-IW';
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'month':
|
||||||
|
$fmt = 'YYYY-MM';
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'year':
|
||||||
|
$fmt = 'YYYY';
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->addSelect(sprintf("TO_CHAR(workeval.endDate, '%s') AS eval_by_end_date_aggregator", $fmt));
|
||||||
|
$qb->addGroupBy(' eval_by_end_date_aggregator');
|
||||||
|
$qb->addOrderBy(' eval_by_end_date_aggregator', 'ASC');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -36,15 +70,27 @@ class ByEndDateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
// No form needed
|
$builder->add('frequency', ChoiceType::class, [
|
||||||
|
'choices' => self::CHOICES,
|
||||||
|
'multiple' => false,
|
||||||
|
'expanded' => true,
|
||||||
|
'empty_data' => self::DEFAULT_CHOICE,
|
||||||
|
'data' => self::DEFAULT_CHOICE,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
return static function ($value): string {
|
return static function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
return 'export.aggregator.eval.by_end_date.End date period';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +101,6 @@ class ByEndDateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'Group by end date evaluations';
|
return 'export.aggregator.eval.by_end_date.Group by end date evaluations';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,23 @@ namespace Chill\PersonBundle\Export\Aggregator\EvaluationAggregators;
|
|||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use LogicException;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class ByMaxDateAggregator implements AggregatorInterface
|
class ByMaxDateAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
private const CHOICES = [
|
||||||
|
'by week' => 'week',
|
||||||
|
'by month' => 'month',
|
||||||
|
'by year' => 'year',
|
||||||
|
];
|
||||||
|
|
||||||
|
private const DEFAULT_CHOICE = 'year';
|
||||||
|
|
||||||
|
private TranslatorInterface $translator;
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -25,8 +38,29 @@ class ByMaxDateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->addSelect('AS eval_by_max_date_aggregator')
|
switch ($data['frequency']) {
|
||||||
->addGroupBy('eval_by_max_date_aggregator');
|
case 'week':
|
||||||
|
$fmt = 'YYYY-IW';
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'month':
|
||||||
|
$fmt = 'YYYY-MM';
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'year':
|
||||||
|
$fmt = 'YYYY';
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->addSelect(sprintf("TO_CHAR(workeval.maxDate, '%s') AS eval_by_max_date_aggregator", $fmt));
|
||||||
|
$qb->addGroupBy(' eval_by_max_date_aggregator');
|
||||||
|
$qb->addOrderBy(' eval_by_max_date_aggregator', 'ASC');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -36,15 +70,27 @@ class ByMaxDateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
// No form needed
|
$builder->add('frequency', ChoiceType::class, [
|
||||||
|
'choices' => self::CHOICES,
|
||||||
|
'multiple' => false,
|
||||||
|
'expanded' => true,
|
||||||
|
'empty_data' => self::DEFAULT_CHOICE,
|
||||||
|
'data' => self::DEFAULT_CHOICE,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
return static function ($value): string {
|
return static function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
return 'export.aggregator.eval.by_max_date.Max date';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +101,6 @@ class ByMaxDateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'Group by max date evaluations';
|
return 'export.aggregator.eval.by_max_date.Group by max date evaluations';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
class ByStartDateAggregator implements AggregatorInterface
|
class ByStartDateAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private const CHOICES = [
|
private const CHOICES = [
|
||||||
'by month' => 'month',
|
|
||||||
'by week' => 'week',
|
'by week' => 'week',
|
||||||
|
'by month' => 'month',
|
||||||
'by year' => 'year',
|
'by year' => 'year',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -39,13 +39,13 @@ class ByStartDateAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
switch ($data['frequency']) {
|
switch ($data['frequency']) {
|
||||||
case 'month':
|
case 'week':
|
||||||
$fmt = 'YYYY-MM';
|
$fmt = 'YYYY-IW';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'week':
|
case 'month':
|
||||||
$fmt = 'YYYY-IW';
|
$fmt = 'YYYY-MM';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -587,8 +587,6 @@ end period date: Date de fin de la période
|
|||||||
"Filtered by end date: between %start_date% and %end_date%": "Filtré par la date de fin: comprise entre %start_date% et %end_date%"
|
"Filtered by end date: between %start_date% and %end_date%": "Filtré par la date de fin: comprise entre %start_date% et %end_date%"
|
||||||
Filter by current evaluations: Filtrer les évaluations en cours
|
Filter by current evaluations: Filtrer les évaluations en cours
|
||||||
"Filtered by current evaluations": "Filtré: uniquement les évaluations en cours"
|
"Filtered by current evaluations": "Filtré: uniquement les évaluations en cours"
|
||||||
Group by end date evaluations: Grouper les évaluations par semaine/mois/année de la date de fin
|
|
||||||
Group by max date evaluations: Grouper les évaluations par semaine/mois/année de la date d'échéance
|
|
||||||
|
|
||||||
## social actions filters/aggr
|
## social actions filters/aggr
|
||||||
Filter by treating agent scope: Filtrer les actions par service de l'agent traitant
|
Filter by treating agent scope: Filtrer les actions par service de l'agent traitant
|
||||||
@ -1022,9 +1020,15 @@ export:
|
|||||||
Group evaluations having end date: Grouper les évaluations en cours (avec ou sans date de fin)
|
Group evaluations having end date: Grouper les évaluations en cours (avec ou sans date de fin)
|
||||||
enddate is specified: la date de fin est spécifiée
|
enddate is specified: la date de fin est spécifiée
|
||||||
enddate is not specified: la date de fin n'est pas spécifiée
|
enddate is not specified: la date de fin n'est pas spécifiée
|
||||||
|
Group by end date evaluations: Grouper les évaluations par semaine/mois/année de la date de fin
|
||||||
|
End date period: Fin (par periode)
|
||||||
by_start_date_period:
|
by_start_date_period:
|
||||||
Start date period: Début (par periode)
|
Start date period: Début (par periode)
|
||||||
Group by start date evaluations: Grouper les évaluations par semaine/mois/année de la date de début
|
Group by start date evaluations: Grouper les évaluations par semaine/mois/année de la date de début
|
||||||
|
by_max_date:
|
||||||
|
Group by max date evaluations: Grouper les évaluations par semaine/mois/année de la date d'échéance
|
||||||
|
Max date: Date d'échéance
|
||||||
|
|
||||||
filter:
|
filter:
|
||||||
course:
|
course:
|
||||||
by_user_scope:
|
by_user_scope:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user