protected function UserController::getTargetAttempt in Opigno statistics 8
Same name and namespace in other branches
- 3.x 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 594
Class
- UserController
- Class UserController.
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;
}