function opigno_learning_path_get_time_spent in Opigno Learning path 8
Same name and namespace in other branches
- 3.x opigno_learning_path.module \opigno_learning_path_get_time_spent()
Calculates time spent in training.
Parameters
int $gid: Training group ID.
int $uid: User ID.
Return value
int Time spent in seconds.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
2 calls to opigno_learning_path_get_time_spent()
- opigno_learning_path_save_achievements in ./
opigno_learning_path.module - Stores training achievements data.
- Progress::getProgressBuildAchievementsPage in src/
Progress.php - Get get progress for achievements page.
File
- ./
opigno_learning_path.module, line 3465 - Contains opigno_learning_path.module.
Code
function opigno_learning_path_get_time_spent($gid, $uid) {
$steps = opigno_learning_path_get_steps($gid, $uid);
return array_sum(array_map(function ($step) {
return $step['time spent'];
}, $steps));
}