Fix Exercise result if was added inside a LP see BT#9494

1.9.x
Julio Montoya 11 years ago
parent 4235e46f20
commit 96ab630c17
  1. 33
      main/gradebook/lib/be/exerciselink.class.php

@ -192,15 +192,34 @@ class ExerciseLink extends AbstractLink
/* the following query should be similar (in conditions) to the one used /* the following query should be similar (in conditions) to the one used
in exercice/exercice.php, look for note-query-exe-results marker*/ in exercice/exercice.php, look for note-query-exe-results marker*/
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$exercise = new Exercise();
$exercise->read($this->get_ref_id());
if (!$this->is_hp) { if (!$this->is_hp) {
$sql = "SELECT * FROM $tblStats if ($exercise->exercise_was_added_in_lp == false) {
WHERE $sql = "SELECT * FROM $tblStats
exe_exo_id = ".intval($this->get_ref_id())." AND WHERE
orig_lp_id = 0 AND exe_exo_id = ".intval($this->get_ref_id())." AND
orig_lp_item_id = 0 AND orig_lp_id = 0 AND
status <> 'incomplete' AND orig_lp_item_id = 0 AND
session_id = $session_id"; status <> 'incomplete' AND
session_id = $session_id";
} else {
$lpId = null;
if (!empty($exercise->lpList)) {
// Taking only the first LP
$lpId = current($exercise->lpList);
$lpId = $lpId['lp_id'];
}
$sql = "SELECT * FROM $tblStats
WHERE
exe_exo_id = ".intval($this->get_ref_id())." AND
orig_lp_id = $lpId AND
status <> 'incomplete' AND
session_id = $session_id";
}
if (isset($stud_id)) { if (isset($stud_id)) {
$course_code_exe = $this->get_course_code(); $course_code_exe = $this->get_course_code();
$sql .= " AND exe_cours_id = '$course_code_exe' AND exe_user_id = '$stud_id' "; $sql .= " AND exe_cours_id = '$course_code_exe' AND exe_user_id = '$stud_id' ";

Loading…
Cancel
Save