plugin/exo/Manager/Attempt/PaperManager.php
public function calculateTotal(Paper $paper)
    {
        $total = 0;

        $structure = json_decode($paper->getStructure(), true);

        foreach ($structure['steps'] as $step) {
            foreach ($step['items'] as $item) {
                if (1 === preg_match('#^application\/x\.[^/]+\+json$#', $item['type'])) {
                    $total += $this->itemManager->calculateTotal($item);
                }
            }
        }

        return $total;
    }
public function calculateTotal(Paper $paper)
    {
        $total = 0;

        $structure = json_decode($paper->getStructure(), true);

        foreach ($structure['steps'] as $step) {
            foreach ($step['items'] as $item) {
                if (1 === preg_match('#^application\/x\.[^/]+\+json$#', $item['type'])) {
                    $total += $this->itemManager->calculateTotal($item);
                }
            }
        }

        return $total;
    }
public function calculateTotal ( Paper $ paper ) { $ total = 0 ; $ structure = json_decode ( $ paper -> getStructure ( ) , true ) ; foreach ( $ structure [ 'steps' ] as $ step ) { foreach ( $ step [ 'items' ] as $ item ) { if ( 1 === preg_match ( '#^application\/x\.[^/]+\+json$#' , $ item [ 'type' ] ) ) { $ total += $ this -> itemManager -> calculateTotal ( $ item ) ; } } } return $ total ; }
Calculates the total score of a Paper.

@param Paper $paper

@return float
Calculates the total score of a Paper .