You are here

function opigno_learning_path_get_module_best_score in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x opigno_learning_path.module \opigno_learning_path_get_module_best_score()

Calculates module best score.

Parameters

int $id: Module id.

int $uid: User id.

Return value

int Score in percent.

File

./opigno_learning_path.module, line 2552
Contains opigno_learning_path.module.

Code

function opigno_learning_path_get_module_best_score($id, $uid) {
  $score =& drupal_static(__FUNCTION__);
  $key = "{$id}_{$uid}";
  if (!isset($score[$key])) {
    $opigno_module = OpignoModule::load($id);
    $user = User::load($uid);
    $score[$key] = $opigno_module
      ->getBestScore($user);
  }
  return $score[$key];
}