You are here

public function QuizSession::setResult in Quiz 6.x

Set a quiz result for the current user.

Parameters

QuizResult $quiz_result: The quiz result.

Overrides QuizSessionInterface::setResult

File

src/Services/QuizSession.php, line 86

Class

QuizSession
Default implementation of the quiz session.

Namespace

Drupal\quiz\Services

Code

public function setResult(QuizResult $quiz_result) {
  $current_quizzes = $this
    ->getCurrentQuizzes();
  $current_quizzes[$quiz_result
    ->getQuiz()
    ->id()][self::RESULT_ID] = $quiz_result
    ->id();
  $this
    ->setCurrentQuizzes($current_quizzes);
}