Commit 6460c88f authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Fixing dépouillage

parent fb45c659
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ class ResultatController extends AbstractActionController

        $resultats = [];
        foreach ($instances as $instance) {
            if ($instance !== null && $instance->getValidationEnquete() !== null) $resultats[] = $instance;
            if ($instance !== null && $instance->getValidation() !== null) $resultats[] = $instance;
        }

        [$counts, $results] = $this->getResultatService()->generateResultatArray($enquete, $resultats);
+4 −2
Original line number Diff line number Diff line
@@ -30,8 +30,10 @@ class ResultatService
            if ($question->estNonHistorise() and ($question->getGroupe() === null or $question->getGroupe()->estNonHistorise())) {
                /** @var Instance $item */
                foreach ($resultats as $item) {
                    if ($item->estNonHistorise() && $item->getEnquete()->getValidation()) {
                        $reponse = ($item->getEnquete())?->getReponseFor($question);
                    if ($item->estNonHistorise()) {
                        $reponse = null;
                        if ($item instanceof Instance) $reponse =  $item->getReponseFor($question);
                        if ($item instanceof HasEnqueteInterface AND $item->getEnquete() AND $item->getEnquete()->getValidation()) $reponse = $item->getEnquete()->getReponseFor($question);
                        if ($reponse) {
                            if ($reponse->getReponse()) $results[$question->getId()][$reponse->getReponse()][] = $item->getId();
                            if ($reponse->getReponse() === "0") {
+7 −2
Original line number Diff line number Diff line
<?php

use UnicaenEnquete\Entity\Db\Enquete;
use UnicaenEnquete\Entity\Db\Instance;
use UnicaenEnquete\Entity\Db\Question;
use UnicaenEnquete\Entity\HasEnqueteInterface;

@@ -288,7 +289,9 @@ $nbElements = count($elements);
        <?php
        $valeurs = [];
        foreach ($elements as $element) {
            $reponse = ($element->getEnquete())?->getReponseFor($question);
            $reponse = null;
            if ($reponse instanceof Instance) $reponse = $element->getReponseFor($question);
            if ($reponse instanceof HasEnqueteInterface AND $reponse->getEnquete() AND $reponse->getEnquete()->getValidation()) $reponse = $element->getEnquete()->getReponseFor($question);
            if ($reponse && $reponse->getCommentaire()) {
                $valeurs[$element->getEnquete()->getId()] = $reponse->getCommentaire();
            }
@@ -347,7 +350,9 @@ $nbElements = count($elements);
        $data = [];
        $data['Id'] = ($element->getEnquete())?->getId();
        foreach ($enquete->getQuestions() as $question) {
            $reponse = ($element->getEnquete())?->getReponseFor($question);
            $reponse = null;
            if ($reponse instanceof Instance) $reponse = $element->getReponseFor($question);
            if ($reponse instanceof HasEnqueteInterface AND $reponse->getEnquete() AND $reponse->getEnquete()->getValidation()) $reponse = $element->getEnquete()->getReponseFor($question);
            if ($reponse) {
                if ($question->hasNote()) $data['evaluation_' . $question->getId()] = ($reponse->getReponse()) ?? "";
                if ($question->hasCommentaire()) $data['commentaire_' . $question->getId()] = ($reponse->getCommentaire()) ?? "";