Fixing query using "iid" instead of id due the global/local categories see BT#5638

skala
Julio Montoya 12 years ago
parent 4f50329704
commit 5cf794ae30
  1. 6
      main/coursecopy/classes/CourseBuilder.class.php
  2. 6
      main/coursecopy/classes/CourseRecycler.class.php
  3. 2
      main/exercice/Hpdownload.php
  4. 8
      main/exercice/question_pool.php

@ -523,7 +523,7 @@ class CourseBuilder {
//2nd union gets the orphan questions from question that were deleted in a exercise.
$sql = " (
SELECT q.* FROM $table_que q INNER JOIN $table_rel r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
INNER JOIN $table_qui ex
ON (ex.id = r.exercice_id AND ex.c_id =r.c_id )
WHERE ex.c_id = $course_id AND ex.active = '-1'
@ -532,14 +532,14 @@ class CourseBuilder {
(
SELECT q.* FROM $table_que q left
OUTER JOIN $table_rel r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
WHERE q.c_id = $course_id AND r.question_id is null
)
UNION
(
SELECT q.* FROM $table_que q
INNER JOIN $table_rel r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
WHERE r.c_id = $course_id AND r.exercice_id = '-1' OR r.exercice_id = '0'
)
";

@ -352,7 +352,7 @@ class CourseRecycler
$sql = " (
SELECT q.id FROM $table_qui_que q
INNER JOIN $table_rel r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
INNER JOIN $table_qui ex
ON (ex.id = r.exercice_id AND ex.c_id = r.c_id )
WHERE ex.c_id = ".$this->course_id." AND (ex.active = '-1' OR ex.id = '-1')
@ -361,14 +361,14 @@ class CourseRecycler
(
SELECT q.id FROM $table_qui_que q
LEFT OUTER JOIN $table_rel r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
WHERE q.c_id = ".$this->course_id." AND r.question_id is null
)
UNION
(
SELECT q.id FROM $table_qui_que q
INNER JOIN $table_rel r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
WHERE r.c_id = ".$this->course_id." AND r.exercice_id = '-1' OR r.exercice_id = '0'
)";

@ -91,7 +91,7 @@ if ($content_type == 'text/html') {
$directory_name = dirname($full_file_name);
$dir = str_replace(
array('\\', $_configuration['root_sys']."courses/".$_course['path'].'/document'),
array('\\', api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'),
array('/', ''),
$directory_name
);

@ -443,23 +443,23 @@ if ($exerciseId > 0) {
$sql = " (
SELECT q.* FROM $TBL_QUESTIONS q INNER JOIN $TBL_EXERCICE_QUESTION r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
INNER JOIN $TBL_EXERCICES ex
ON (ex.id = r.exercice_id AND ex.c_id =r.c_id ) $from
ON (ex.id = r.exercice_id AND ex.c_id = r.c_id ) $from
WHERE ex.c_id = '$selected_course' AND ex.active = '-1' $level_where $answer_where
)
UNION
(
SELECT q.* FROM $TBL_QUESTIONS q
LEFT OUTER JOIN $TBL_EXERCICE_QUESTION r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
WHERE q.c_id = '$selected_course' AND r.question_id is null $level_where $answer_where
)
UNION
(
SELECT q.* FROM $TBL_QUESTIONS q
INNER JOIN $TBL_EXERCICE_QUESTION r
ON (q.c_id = r.c_id AND q.id = r.question_id)
ON (q.c_id = r.c_id AND q.iid = r.question_id)
WHERE r.c_id = '$selected_course' AND r.exercice_id = '-1' OR r.exercice_id = '0' $level_where $answer_where
)";

Loading…
Cancel
Save