You are here

function opigno_learning_path_get_attempt_score in Opigno Learning path 3.x

Same name and namespace in other branches
  1. 8 opigno_learning_path.module \opigno_learning_path_get_attempt_score()

Calculates module attempt score.

Parameters

\Drupal\opigno_module\Entity\UserModuleStatus $attempt: Attempt object.

Return value

int Score in percent.

File

./opigno_learning_path.module, line 2439
Contains opigno_learning_path.module.

Code

function opigno_learning_path_get_attempt_score(UserModuleStatus $attempt) {
  $id = $attempt
    ->id();
  $result =& drupal_static(__FUNCTION__);
  if (!isset($result[$id])) {
    $result[$id] = $attempt
      ->getAttemptScore();
  }
  return $result[$id];
}