plugin/exo/Manager/AttemptManager.php
public function end(Paper $paper, $finished = true, $generateEvaluation = true)
    {
        $this->om->startFlushSuite();

        if (!$paper->getEnd()) {
            $paper->setEnd(new \DateTime());
        }

        $paper->setInterrupted(!$finished);
        $totalScoreOn = $paper->getExercise()->getTotalScoreOn();
        $score = $this->paperManager->calculateScore($paper, $totalScoreOn);
        $paper->setScore($score);

        if ($generateEvaluation) {
            $this->paperManager->generateResourceEvaluation($paper, $finished);
        }
        $this->om->persist($paper);
        $this->om->endFlushSuite();

        $this->paperManager->checkPaperEvaluated($paper);
    }
public function end(Paper $paper, $finished = true, $generateEvaluation = true)
    {
        $this->om->startFlushSuite();

        if (!$paper->getEnd()) {
            $paper->setEnd(new \DateTime());
        }

        $paper->setInterrupted(!$finished);
        $totalScoreOn = $paper->getExercise()->getTotalScoreOn();
        $score = $this->paperManager->calculateScore($paper, $totalScoreOn);
        $paper->setScore($score);

        if ($generateEvaluation) {
            $this->paperManager->generateResourceEvaluation($paper, $finished);
        }
        $this->om->persist($paper);
        $this->om->endFlushSuite();

        $this->paperManager->checkPaperEvaluated($paper);
    }
public function end ( Paper $ paper , $ finished = true , $ generateEvaluation = true ) { $ this -> om -> startFlushSuite ( ) ; if ( ! $ paper -> getEnd ( ) ) { $ paper -> setEnd ( new \ DateTime ( ) ) ; } $ paper -> setInterrupted ( ! $ finished ) ; $ totalScoreOn = $ paper -> getExercise ( ) -> getTotalScoreOn ( ) ; $ score = $ this -> paperManager -> calculateScore ( $ paper , $ totalScoreOn ) ; $ paper -> setScore ( $ score ) ; if ( $ generateEvaluation ) { $ this -> paperManager -> generateResourceEvaluation ( $ paper , $ finished ) ; } $ this -> om -> persist ( $ paper ) ; $ this -> om -> endFlushSuite ( ) ; $ this -> paperManager -> checkPaperEvaluated ( $ paper ) ; }
Ends a user paper.
Sets the end date of the paper and calculates its score.

@param Paper $paper
@param bool  $finished
@param bool  $generateEvaluation
Ends a user paper . Sets the end date of the paper and calculates its score .