You are here

public function LpSteps::getLastAttemptScore in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x src/LpSteps.php \Drupal\opigno_learning_path\LpSteps::getLastAttemptScore()

Get last Attempt score.

Parameters

array $attempts: List of attempts.

Return value

numeric Last score.

1 call to LpSteps::getLastAttemptScore()
LpSteps::getModuleStep in src/LpSteps.php
Get list of module steps.

File

src/LpSteps.php, line 435

Class

LpSteps

Namespace

Drupal\opigno_learning_path

Code

public function getLastAttemptScore(array $attempts) {

  // Get last attempt.
  $last_attempt = end($attempts);

  // Get last attempt score.
  if (!empty($last_attempt)) {
    return $last_attempt
      ->getAttemptScore();
  }
  return 0;
}