protected function LearningPathStepsController::getTargetAttempt in Opigno Learning path 8
Same name and namespace in other branches
- 3.x src/Controller/LearningPathStepsController.php \Drupal\opigno_learning_path\Controller\LearningPathStepsController::getTargetAttempt()
Get last or best user attempt for Module.
Parameters
array $attempts: User module attempts.
\Drupal\opigno_module\Entity\OpignoModule $module: Module.
Return value
\Drupal\opigno_module\Entity\UserModuleStatus $attempt
1 call to LearningPathStepsController::getTargetAttempt()
- LearningPathStepsController::nextStep in src/
Controller/ LearningPathStepsController.php - Redirect the user to the next step.
File
- src/
Controller/ LearningPathStepsController.php, line 779
Class
- LearningPathStepsController
- Class LearningPathStepsController.
Namespace
Drupal\opigno_learning_path\ControllerCode
protected function getTargetAttempt(array $attempts, OpignoModule $module) {
if ($module
->getKeepResultsOption() == 'newest') {
$attempt = end($attempts);
}
else {
$attempt = opigno_learning_path_best_attempt($attempts);
}
return $attempt;
}