public function statisticsAction(Exercise $exercise)
    {
        if (!$exercise->hasStatistics()) {
            $this->assertHasPermission('EDIT', $exercise);
        }
        $statistics = [];
        $finishedOnly = !$exercise->isAllPapersStatistics();

        foreach ($exercise->getSteps() as $step) {
            foreach ($step->getQuestions() as $question) {
                $itemStats = $this->itemManager->getStatistics($question, $exercise, $finishedOnly);
                $statistics[$question->getUuid()] = !empty($itemStats['solutions']) ? $itemStats['solutions'] : new \stdClass();
            }
        }

        return new JsonResponse($statistics);
    }