public function LearningPathAchievementController::getStatusPercentCourseByStep in Opigno Learning path 3.x
Gets an passed/percent of course state by the step.
Copy of legacy code.
1 call to LearningPathAchievementController::getStatusPercentCourseByStep()
- LearningPathAchievementController::trainingStepCourseBuild in src/
Controller/ LearningPathAchievementController.php - If step is course prepares a render array of content.
File
- src/
Controller/ LearningPathAchievementController.php, line 660
Class
- LearningPathAchievementController
- Class LearningPathAchievementController.
Namespace
Drupal\opigno_learning_path\ControllerCode
public function getStatusPercentCourseByStep($step, $latest_cert_date, $group) : array {
$course_steps = $this
->course_steps_passed($group, Group::load($step['id']), $latest_cert_date);
$passed = $course_steps['passed'] . '/' . $course_steps['total'];
$passed_percent = $course_steps['passed'] / $course_steps['total'] * 100;
$score = $step['best score'];
$score_percent = $score;
return [
$passed,
$passed_percent,
$score_percent,
];
}