Browse Source

Minor - use api_get_user_info_from_username() to get user info

Fix firstname, lastname see #2717
Julio Montoya 6 years ago
parent
commit
a77d77132a
1 changed files with 7 additions and 3 deletions
  1. 7 3
      main/tracking/courseLog.php

+ 7 - 3
main/tracking/courseLog.php

@@ -359,7 +359,11 @@ if ($nbStudents > 0) {
     );
 
     foreach ($usersTracking as $userTracking) {
-        $userId = UserManager::get_user_id_from_username($userTracking[3]);
+        $userInfo = api_get_user_info_from_username($userTracking[3]);
+        if (empty($userInfo)) {
+            continue;
+        }
+        $userId = $userInfo['user_id'];
         if ($userTracking[5] === '100%') {
             $numberStudentsCompletedLP++;
         }
@@ -386,10 +390,10 @@ if ($nbStudents > 0) {
 
         $listStudent = [
             'id' => $userId,
-            'fullname' => $userTracking[2].', '.$userTracking[1],
+            'fullname' => $userInfo['complete_name'],
             'score' => floor($scoreStudent / 2),
             'total_time' => $minutes,
-            'avatar' => UserManager::getUserPicture($userId),
+            'avatar' => $userInfo['avatar'],
             'certicate' => $certificate,
         ];
         $listStudentIds[] = $userId;