Calculates and returns the possible minimum and maximum score (in points) for this rubric

@return array
197710
public function get_min_max_score() {
        if (!$this->is_form_available()) {
            return null;
        }
        $returnvalue = array('minscore' => 0, 'maxscore' => 0);
        foreach ($this->get_definition()->rubric_criteria as $id => $criterion) {
            $scores = array();
            foreach ($criterion['levels'] as $level) {
                $scores[] = $level['score'];
            }
            sort($scores);
            $returnvalue['minscore'] += $scores[0];
            $returnvalue['maxscore'] += $scores[sizeof($scores)-1];
        }
        return $returnvalue;
    }
1222841
public function recalculateStats()
	{
		if (empty($this->stats)) {
			$this->stats = new Stats();
		}

		$this->stats->reset();

		if (empty($this->segments)) {
			return;
		}

		$segmentsCount = count($this->segments);

		$firstSegment = null;
		$firstPoint = null;

		// Identify first Segment/Point
		for ($s = 0; $s < $segmentsCount; $s++) {
			$pointCount = count($this->segments[$s]->points);
			for ($p = 0; $p < $pointCount; $p++) {
				if (is_null($firstPoint)) {
					$firstPoint = &$this->segments[$s]->points[$p];
					$firstSegment = &$this->segments[$s];
					break;
				}
			}
		}

		if (empty($firstPoint)) {
			return;
		}

		$lastSegment = end($this->segments);
		$lastPoint = end(end($this->segments)->points);

		$this->stats->startedAt = $firstPoint->time;
		$this->stats->finishedAt = $lastPoint->time;
		$this->stats->minAltitude = $firstPoint->elevation;

		for ($s = 0; $s < $segmentsCount; $s++) {
			$this->segments[$s]->recalculateStats();

			$this->stats->cumulativeElevationGain += $this->segments[$s]->stats->cumulativeElevationGain;
			$this->stats->cumulativeElevationLoss += $this->segments[$s]->stats->cumulativeElevationLoss;

			$this->stats->distance += $this->segments[$s]->stats->distance;

			if ($this->stats->minAltitude === null) {
				$this->stats->minAltitude = $this->segments[$s]->stats->minAltitude;
			}
			if ($this->stats->maxAltitude < $this->segments[$s]->stats->maxAltitude) {
				$this->stats->maxAltitude = $this->segments[$s]->stats->maxAltitude;
			}
			if ($this->stats->minAltitude > $this->segments[$s]->stats->minAltitude) {
				$this->stats->minAltitude = $this->segments[$s]->stats->minAltitude;
			}
		}

		if (($firstPoint->time instanceof \DateTime) && ($lastPoint->time instanceof \DateTime)) {
			$this->stats->duration = $lastPoint->time->getTimestamp() - $firstPoint->time->getTimestamp();

			if ($this->stats->duration != 0) {
				$this->stats->averageSpeed = $this->stats->distance / $this->stats->duration;
			}

			if ($this->stats->distance != 0) {
				$this->stats->averagePace = $this->stats->duration / ($this->stats->distance / 1000);
			}
		}
	}
87545
public function getOverallScore()
    {
        if ($this->environmentalScore != $this->baseScore) {
            return $this->environmentalScore;
        }
        elseif ($this->temporalScore != $this->baseScore) {
            return $this->temporalScore;
        }
        else {
            return $this->baseScore;
        }
    }
101694
public function getMaxValue()
    {
        $values = $this->values->toArray();

        uasort($values, $this->cmpValues('getName'));

        return end($values);
    }
1343563
private function calculate()
    {
        if (count($this->points) < 2) {
            throw new \RuntimeException('There must be two or more points (co-ordinates) before a calculation can be performed.');
        }
        $total = 0;
        foreach ($this->points as $point) {
            if (isset($previous)) {
                $total += $this->distanceBetweenPoints($previous, $point);
            }
            $previous = $point;
        }
        return $total;
    }
226525
public function GetAverageScore()
    {
        $dAvgScore = 0;
        if ($this->Length() > 0) {
            $iPt = $this->getItemPointer();
            $this->GoToStart();
            $dScore = 0;
            while ($oitem = &$this->Next()) {
                $dScore += $oitem->fieldRating;
            }
            $this->setItemPointer($iPt);

            $dAvgScore = $dScore / $this->Length();
        }

        return $dAvgScore;
    }
1209293
public function get_grade() {
        $grade = $this->get_rubric_filling();

        if (!($scores = $this->get_controller()->get_min_max_score()) || $scores['maxscore'] <= $scores['minscore']) {
            return -1;
        }

        $graderange = array_keys($this->get_controller()->get_grade_range());
        if (empty($graderange)) {
            return -1;
        }
        sort($graderange);
        $mingrade = $graderange[0];
        $maxgrade = $graderange[sizeof($graderange) - 1];

        $curscore = 0;
        foreach ($grade['criteria'] as $id => $record) {
            $curscore += $this->get_controller()->get_definition()->rubric_criteria[$id]['levels'][$record['levelid']]['score'];
        }

        $allowdecimals = $this->get_controller()->get_allow_grade_decimals();
        $options = $this->get_controller()->get_options();

        if ($options['lockzeropoints']) {
            // Grade calculation method when 0-level is locked.
            $grade = max($mingrade, $curscore / $scores['maxscore'] * $maxgrade);
            return $allowdecimals ? $grade : round($grade, 0);
        } else {
            // Alternative grade calculation method.
            $gradeoffset = ($curscore - $scores['minscore']) / ($scores['maxscore'] - $scores['minscore']) * ($maxgrade - $mingrade);
            return ($allowdecimals ? $gradeoffset : round($gradeoffset, 0)) + $mingrade;
        }
    }
429821
public function weight()
    {
        $scores = [];
        foreach ($this->results as $result) {
            $scores[] = $this->getResultScore($result);
        }

        return $scores;
    }
837811
public function getRatingValue()
    {
        if ($this->_ratingValue === null) {
            return null;
        }

        $range = new RangeValue($this->_ratingValue);
        $range->ensureRange($this->_worstRating ?: 0, $this->_bestRating ?: 5);

        return $this->_ratingValue = $range->getValue();
    }
1001386
public function get_grade() {
        $grade = $this->get_guide_filling();

        if (!($scores = $this->get_controller()->get_min_max_score()) || $scores['maxscore'] <= $scores['minscore']) {
            return -1;
        }

        $graderange = array_keys($this->get_controller()->get_grade_range());
        if (empty($graderange)) {
            return -1;
        }
        sort($graderange);
        $mingrade = $graderange[0];
        $maxgrade = $graderange[count($graderange) - 1];

        $curscore = 0;
        foreach ($grade['criteria'] as $record) {
            $curscore += $record['score'];
        }
        $gradeoffset = ($curscore-$scores['minscore'])/($scores['maxscore']-$scores['minscore'])*
            ($maxgrade-$mingrade);
        if ($this->get_controller()->get_allow_grade_decimals()) {
            return $gradeoffset + $mingrade;
        }
        return round($gradeoffset, 0) + $mingrade;
    }
1038803
public function getPercentagePartial()
    {
        $total = $this->getTotal();

        return round((($this->score->getValid() + $this->score->getPartial())/$total) * 100);
    }
895100
private function calculate()
    {
        /**
         * Base score
         */
        $impactSubScore = 0;
        $impactSubScoreBase = 1 - ((1 - $this->vectorLevels['C']) * (1 - $this->vectorLevels['I']) * (1 - $this->vectorLevels['A']));
        switch ($this->vectorInputs['S']) {
            case 'U':
                $impactSubScore = $this->vectorLevels['S'] * $impactSubScoreBase;
                break;
            case 'C':
                $impactSubScore = $this->vectorLevels['S'] * ($impactSubScoreBase - 0.029) - 3.25 * pow(($impactSubScoreBase - 0.02), 15);
                break;
        }

        $exploitabilitySubScore = self::$exploitabilityCoefficient * $this->vectorLevels['AV'] * $this->vectorLevels['AC'] * $this->vectorLevels['PR'] * $this->vectorLevels['UI'];

        if ($impactSubScore <= 0) {
            $this->baseScore = 0;
        }
        else {
            switch ($this->vectorInputs['S']) {
                case 'U':
                    $this->baseScore = self::roundUp(min($impactSubScore + $exploitabilitySubScore, 10));
                    break;
                case 'C':
                    $this->baseScore = self::roundUp(min(self::$scopeCoefficient * ($impactSubScore + $exploitabilitySubScore), 10));
                    break;
            }
        }

        /**
         * Temporal score
         */
        $this->temporalScore = self::roundUp($this->baseScore * $this->vectorLevels['E'] * $this->vectorLevels['RL'] * $this->vectorLevels['RC']);

        /**
         * Environmental score
         */
        $modifiedImpactSubScore = 0;
        $modifiedImpactSubScoreBase = min(1 - ((1 - $this->vectorLevels['MC'] * $this->vectorLevels['CR']) * (1 - $this->vectorLevels['MI'] * $this->vectorLevels['IR']) * (1 - $this->vectorLevels['MA'] * $this->vectorLevels['AR'])), 0.915);
        $modifiedScope = isset($this->vectorInputs['MS']) && $this->vectorInputs['MS'] != 'X' ? $this->vectorInputs['MS'] : $this->vectorInputs['S'];
        switch ($modifiedScope) {
            case 'U':
                $modifiedImpactSubScore = $this->vectorLevels['MS'] * $modifiedImpactSubScoreBase;
                break;
            case 'C':
                $modifiedImpactSubScore = $this->vectorLevels['MS'] * ($modifiedImpactSubScoreBase - 0.029) - 3.25 * pow(($modifiedImpactSubScoreBase - 0.02), 15);
                break;
        }

        $modifiedExploitabilitySubScore = self::$exploitabilityCoefficient * $this->vectorLevels['MAV'] * $this->vectorLevels['MAC'] * $this->vectorLevels['MPR'] * $this->vectorLevels['MUI'];

        if ($modifiedImpactSubScore <= 0) {
            $this->environmentalScore = $this->baseScore;
        }
        else {
            switch ($modifiedScope) {
                case 'U':
                    $this->environmentalScore = self::roundUp(self::roundUp(min($modifiedImpactSubScore + $modifiedExploitabilitySubScore, 10)) * $this->vectorLevels['E'] * $this->vectorLevels['RL'] * $this->vectorLevels['RC']);
                    break;
                case 'C':
                    $this->environmentalScore = self::roundUp(self::roundUp(min(self::$scopeCoefficient * ($modifiedImpactSubScore + $modifiedExploitabilitySubScore), 10)) * $this->vectorLevels['E'] * $this->vectorLevels['RL'] * $this->vectorLevels['RC']);
                    break;
            }
        }
    }
895397
public function getResult () : Result
    {
        // Cache
        if ( $this->_Result === null ) :
            $this->calcPossibleRanking();
            $this->calcRankingScore();
            $this->makeRanking();
            $this->conflictInfos();
        endif;

        // Return
        return $this->_Result;
    }
585974
protected function makeResult () : array
    {
        $result = [];
        $alreadyDone = [];

        $rang = 1;
        while (count($alreadyDone) < $this->_selfElection->countCandidates()) :
            $winners = $this->getWinners($alreadyDone);

            foreach ($this->_Arcs as $ArcKey => $Arcvalue) :
                foreach ($winners as $oneWinner) :
                    if ($Arcvalue['from'] === $oneWinner || $Arcvalue['to'] === $oneWinner ) :
                        unset($this->_Arcs[$ArcKey]);
                    endif;
                endforeach;
            endforeach;

            $result[$rang++] = $winners;
            $alreadyDone = array_merge($alreadyDone,$winners);
        endwhile;

        return $result;
    }
215767
private function getLastPageQueryCriteria() {
        $start = $this->getCount() - $this->getIndexCriteria()->getLimit();
        if($start < 0) {
            $start = 0;
        }
        return array(
            'start' => $start,
            'count' => $this->getIndexCriteria()->getLimit()
        );
    }
1331381
public function get_maximum_tries() {
        $max = 1;
        foreach ($this->get_variant_nos() as $variantno) {
            foreach ($this->get_subpart_ids($variantno) as $subpartid) {
                $max = max($max, $this->get_analysis_for_subpart($variantno, $subpartid)->get_maximum_tries());
            }
        }
        return $max;
    }
669589
public function getHighGradeAllowableValues()
    {
        return [
            self::HIGH_GRADE__1,
            self::HIGH_GRADE__2,
            self::HIGH_GRADE__3,
            self::HIGH_GRADE__4,
            self::HIGH_GRADE__5,
            self::HIGH_GRADE__6,
            self::HIGH_GRADE__7,
            self::HIGH_GRADE__8,
            self::HIGH_GRADE__9,
            self::HIGH_GRADE__10,
            self::HIGH_GRADE__11,
            self::HIGH_GRADE__12,
            self::HIGH_GRADE_PRE_KINDERGARTEN,
            self::HIGH_GRADE_KINDERGARTEN,
            self::HIGH_GRADE_POST_GRADUATE,
            self::HIGH_GRADE_OTHER,
        ];
    }