protected function UserController::getTargetAttempt in Opigno statistics 3.x
Same name and namespace in other branches
- 8 src/Controller/UserController.php \Drupal\opigno_statistics\Controller\UserController::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 UserController::getTargetAttempt()
- UserController::buildModuleDetails in src/
Controller/ UserController.php - Build render array for a user module details.
File
- src/
Controller/ UserController.php, line 646
Class
- UserController
- Statistics user controller.
Namespace
Drupal\opigno_statistics\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;
}