Exercise: fix pending exercise search to show correct attemps depending on the configuration and the type of user - refs BT#21482

pull/5610/head
NicoDucou 1 year ago
parent 1118d78ff2
commit 4ad53929b4
  1. 6
      main/inc/ajax/model.ajax.php
  2. 31
      main/inc/lib/exercise.lib.php

@ -687,7 +687,8 @@ switch ($action) {
true, true,
$status, $status,
$showAttemptsInSessions, $showAttemptsInSessions,
$questionType $questionType,
true
); );
break; break;
@ -1625,7 +1626,8 @@ switch ($action) {
true, true,
$status, $status,
$showAttemptsInSessions, $showAttemptsInSessions,
$questionType $questionType,
true
); );
break; break;

@ -2228,7 +2228,8 @@ HOTSPOT;
$searchAllTeacherCourses = false, $searchAllTeacherCourses = false,
$status = 0, $status = 0,
$showAttemptsInSessions = false, $showAttemptsInSessions = false,
$questionType = 0 $questionType = 0,
$originPending = false
) { ) {
return self::get_exam_results_data( return self::get_exam_results_data(
null, null,
@ -2248,7 +2249,8 @@ HOTSPOT;
$searchAllTeacherCourses, $searchAllTeacherCourses,
$status, $status,
$showAttemptsInSessions, $showAttemptsInSessions,
$questionType $questionType,
$originPending
); );
} }
@ -2537,7 +2539,8 @@ HOTSPOT;
$searchAllTeacherCourses = false, $searchAllTeacherCourses = false,
$status = 0, $status = 0,
$showAttemptsInSessions = false, $showAttemptsInSessions = false,
$questionType = 0 $questionType = 0,
$originPending = false
) { ) {
//@todo replace all this globals //@todo replace all this globals
global $filter; global $filter;
@ -2636,13 +2639,6 @@ HOTSPOT;
$sessionCondition = " AND ttte.session_id = 0"; $sessionCondition = " AND ttte.session_id = 0";
} }
if (empty($sessionId) &&
api_get_configuration_value('show_exercise_session_attempts_in_base_course')
) {
$session_id_and = '';
$sessionCondition = '';
}
if ($showAttemptsInSessions) { if ($showAttemptsInSessions) {
$sessions = SessionManager::get_sessions_by_general_coach(api_get_user_id()); $sessions = SessionManager::get_sessions_by_general_coach(api_get_user_id());
if (!empty($sessions)) { if (!empty($sessions)) {
@ -2652,9 +2648,24 @@ HOTSPOT;
} }
$session_id_and = " AND te.session_id IN(".implode(',', $sessionIds).")"; $session_id_and = " AND te.session_id IN(".implode(',', $sessionIds).")";
$sessionCondition = " AND ttte.session_id IN(".implode(',', $sessionIds).")"; $sessionCondition = " AND ttte.session_id IN(".implode(',', $sessionIds).")";
} elseif (empty($sessionId) &&
api_get_configuration_value('show_exercise_session_attempts_in_base_course')
) {
$session_id_and = '';
$sessionCondition = '';
} else { } else {
return false; return false;
} }
} elseif (empty($sessionId) &&
api_get_configuration_value('show_exercise_session_attempts_in_base_course')
) {
$session_id_and = '';
$sessionCondition = '';
}
if (api_is_platform_admin() && $originPending) {
$session_id_and = '';
$sessionCondition = '';
} }
$exercise_where = ''; $exercise_where = '';

Loading…
Cancel
Save