Commit f901317e authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Amélioration arrondisseur

aide au débogage
parent 7d142aed
Loading
Loading
Loading
Loading
Loading
+52 −8
Changes for code/formules/testArrondisseurFromService.php: 52 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,56 @@
 * @var $container  \Psr\Container\ContainerInterface
 */

use Formule\Entity\FormuleIntervenant;

$bdd = $container->get(\Unicaen\BddAdmin\Bdd::class);

$tvhs                 = $bdd->select('SELECT id "id", libelle "libelle" FROM type_volume_horaire');
$typesVolumesHoraires = [];
foreach ($tvhs as $tvh) {
    $typesVolumesHoraires[$tvh['id']] = $tvh['libelle'];
}

$evhs                 = $bdd->select('SELECT id "id", libelle "libelle" FROM etat_volume_horaire');
$etatsVolumesHoraires = [];
foreach ($evhs as $evh) {
    $etatsVolumesHoraires[$evh['id']] = $evh['libelle'];
}

// récup intervenantId
$pdata  = [
    'intervenantId'       => [
        'type'  => 'text',
        'label' => 'ID de l\'intervenant',
    ],
    'typeVolumeHoraireId' => [
        'type'    => 'select',
        'options' => $typesVolumesHoraires,
        'label'   => 'Type de volume horaire',
    ],
    'etatVolumeHoraireId' => [
        'type'    => 'select',
        'options' => $etatsVolumesHoraires,
        'label'   => 'État de volume horaire',
    ],
    'arrondir'            => [
        'type'    => 'select',
        'options' => [
            FormuleIntervenant::ARRONDISSEUR_NO      => 'Désactivé',
            FormuleIntervenant::ARRONDISSEUR_MINIMAL => 'Minimal',
            FormuleIntervenant::ARRONDISSEUR_FULL    => 'Full',
            FormuleIntervenant::ARRONDISSEUR_CUSTOM  => 'Custom (pour développer)',
        ],
        'label'   => 'Mode de fonctionnement de l\'arrondisseur',
    ],
];
$params = \UnicaenCode\Util::codeGenerator()->generer($pdata);

if (!$params['intervenantId']) {
    return;
}


/** @var \Formule\Service\FormuleService $fs */
$fs = $container->get(\Formule\Service\FormuleService::class);

@@ -12,14 +62,8 @@ $fs = $container->get(\Formule\Service\FormuleService::class);
$ts = $container->get(\Formule\Service\TestService::class);


$intervenantId = 201;
//$intervenantId = 2032;
$typeVolumeHoraireId = 1;
$etatVolumeHoraireId = 2;
$arrondir = \Formule\Entity\FormuleIntervenant::ARRONDISSEUR_MINIMAL;

$fi = $fs->getFormuleServiceIntervenant($intervenantId, $typeVolumeHoraireId, $etatVolumeHoraireId);
$fi->setArrondisseur($arrondir);
$fi = $fs->getFormuleServiceIntervenant((int)$params['intervenantId'], (int)$params['typeVolumeHoraireId'], (int)$params['etatVolumeHoraireId']);
$fi->setArrondisseur((int)$params['arrondir']);

/* Calcul & affichage des résultats d'arrondissage */
if (isset($fi)) {
+1 −0
Changes for module/Formule/src/Entity/FormuleIntervenant.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ class FormuleIntervenant
    const ARRONDISSEUR_NO      = 0;
    const ARRONDISSEUR_MINIMAL = 1;
    const ARRONDISSEUR_FULL    = 2;
    const ARRONDISSEUR_CUSTOM  = 3;

    // Identifiants
    protected ?int               $id                = null;
+10 −0
Changes for module/Formule/src/Model/Arrondisseur/Arrondisseur.php: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ class Arrondisseur
            case $fi::ARRONDISSEUR_MINIMAL:
                $this->preparerCalculsMinimaux($data);
                break;
            case $fi::ARRONDISSEUR_CUSTOM:
                $this->preparerCalculsCustom($data);
                break;
        }

        foreach ($this->calculs as $ci => $calcul) {
@@ -79,6 +82,13 @@ class Arrondisseur



    protected function preparerCalculsCustom(Ligne $data): void
    {

    }



    protected function preparationHorizontale(Ligne $data): void
    {
        // Sous-total par catégorie