public static function LPResult::getCurrentLPAttempt in Opigno Learning path 8
Same name and namespace in other branches
- 3.x src/Entity/LPResult.php \Drupal\opigno_learning_path\Entity\LPResult::getCurrentLPAttempt()
Returns LP attempt.
2 calls to LPResult::getCurrentLPAttempt()
- LearningPathStepsController::finish in src/
Controller/ LearningPathStepsController.php - Show the finish page and save the score.
- opigno_learning_path_started in ./
opigno_learning_path.module - Function to detect if user already started Learning path.
File
- src/
Entity/ LPResult.php, line 195
Class
- LPResult
- Defines the Learning Path Content entity.
Namespace
Drupal\opigno_learning_path\EntityCode
public static function getCurrentLPAttempt(Group $group, AccountInterface $user) {
$results_storage = \Drupal::entityTypeManager()
->getStorage('learning_path_result');
$query = $results_storage
->getQuery();
$results = $query
->condition('learning_path_id', $group
->id())
->condition('user_id', $user
->id())
->condition('finished', 0)
->execute();
return !empty($results) ? $results_storage
->load(key($results)) : FALSE;
}