Merge remote-tracking branch 'origin/master'

pull/5658/head
Angel Fernando Quiroz Campos 5 months ago
commit 42ad955f05
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 13
      public/main/inc/lib/exercise.lib.php

@ -4842,8 +4842,8 @@ EOT;
{
$em = Database::getManager();
$dql = 'SELECT DISTINCT te.exeUserId FROM ChamiloCoreBundle:TrackEExercise te WHERE te.exeExoId = :id AND te.course = :cId';
$dql .= api_get_session_condition($sessionId, true, false, 'te.sessionId');
$dql = 'SELECT DISTINCT u.id FROM ChamiloCoreBundle:TrackEExercise te JOIN te.user u WHERE te.quiz = :id AND te.course = :cId';
$dql .= api_get_session_condition($sessionId, true, false, 'te.session');
$result = $em
->createQuery($dql)
@ -4853,7 +4853,14 @@ EOT;
$data = [];
foreach ($result as $item) {
$data[] = self::get_best_attempt_by_user($item['exeUserId'], $exerciseId, $courseId, $sessionId);
$attempt = self::get_best_attempt_by_user($item['id'], $exerciseId, $courseId, $sessionId);
if (!empty($attempt) && isset($attempt['score']) && isset($attempt['exe_date'])) {
$data[] = $attempt;
}
}
if (empty($data)) {
return [];
}
usort(

Loading…
Cancel
Save