Statistics/QuestionnaireStatistics.php
public function getScoreByLevel()
    {
        $levels = array();

        /** @var TemplateInterface $template */
        foreach ($this->getData() as $template) {
            $question = $template->getQuestion();

            if (!isset($levels[$question->getLevel()])) {
                $levels[$question->getLevel()] = array(
                    'name' => $question->getLevel(),
                    'valid' => 0,
                    'total' => 0,
                    'color' => '#'.substr('00000'.dechex(mt_rand(0, 0xffffff)), -6)
                );
            }

            if ($template->isValid()) {
                $levels[$question->getLevel()]['valid']++;
            }

            $levels[$question->getLevel()]['total']++;
        }

        sort($levels);

        return $levels;
    }
public function getScoreByLevel()
    {
        $levels = array();

        /** @var TemplateInterface $template */
        foreach ($this->getData() as $template) {
            $question = $template->getQuestion();

            if (!isset($levels[$question->getLevel()])) {
                $levels[$question->getLevel()] = array(
                    'name' => $question->getLevel(),
                    'valid' => 0,
                    'total' => 0,
                    'color' => '#'.substr('00000'.dechex(mt_rand(0, 0xffffff)), -6)
                );
            }

            if ($template->isValid()) {
                $levels[$question->getLevel()]['valid']++;
            }

            $levels[$question->getLevel()]['total']++;
        }

        sort($levels);

        return $levels;
    }
public function getScoreByLevel ( ) { $ levels = array ( ) ; /** @var TemplateInterface $template */ foreach ( $ this -> getData ( ) as $ template ) { $ question = $ template -> getQuestion ( ) ; if ( ! isset ( $ levels [ $ question -> getLevel ( ) ] ) ) { $ levels [ $ question -> getLevel ( ) ] = array ( 'name' => $ question -> getLevel ( ) , 'valid' => 0 , 'total' => 0 , 'color' => '#' . substr ( '00000' . dechex ( mt_rand ( 0 , 0xffffff ) ) , - 6 ) ) ; } if ( $ template -> isValid ( ) ) { $ levels [ $ question -> getLevel ( ) ] [ 'valid' ] ++ ; } $ levels [ $ question -> getLevel ( ) ] [ 'total' ] ++ ; } sort ( $ levels ) ; return $ levels ; }
Get Score by question level

@return array
Get Score by question level