public function getMinMaxAverageScores(Exercise $exercise, $scoreOn)
    {
        $papers = $this->paperRepository->findBy([
            'exercise' => $exercise,
        ]);

        $scores = $this->getPapersScores($papers, $scoreOn);

        $result = [
            'min' => 0 === count($scores) ? 0 : min($scores),
            'max' => 0 === count($scores) ? 0 : max($scores),
        ];
        $average = 0 === count($scores) ? 0 : array_sum($scores) / count($scores);
        $result['avg'] = $average !== floor($average) ? floatval(number_format($average, 2)) : $average;

        return $result;
    }
public function getMinMaxAverageScores(Exercise $exercise, $scoreOn)
    {
        $papers = $this->paperRepository->findBy([
            'exercise' => $exercise,
        ]);

        $scores = $this->getPapersScores($papers, $scoreOn);

        $result = [
            'min' => 0 === count($scores) ? 0 : min($scores),
            'max' => 0 === count($scores) ? 0 : max($scores),
        ];
        $average = 0 === count($scores) ? 0 : array_sum($scores) / count($scores);
        $result['avg'] = $average !== floor($average) ? floatval(number_format($average, 2)) : $average;

        return $result;
    }
public function getMinMaxAverageScores ( Exercise $ exercise , $ scoreOn ) { $ papers = $ this -> paperRepository -> findBy ( [ 'exercise' => $ exercise , ] ) ; $ scores = $ this -> getPapersScores ( $ papers , $ scoreOn ) ; $ result = [ 'min' => 0 === count ( $ scores ) ? 0 : min ( $ scores ) , 'max' => 0 === count ( $ scores ) ? 0 : max ( $ scores ) , ] ; $ average = 0 === count ( $ scores ) ? 0 : array_sum ( $ scores ) / count ( $ scores ) ; $ result [ 'avg' ] = $ average !== floor ( $ average ) ? floatval ( number_format ( $ average , 2 ) ) : $ average ; return $ result ; }
Returns the max min and average score for a given exercise.

@param Exercise $exercise
@param float    $scoreOn

@return array
Returns the max min and average score for a given exercise .