[svn r16879] Fixed ordering bug when removing a question in the middle of an exercise.

Commented question-type setting in answer class, which was using a variable which was never set.
skala
Yannick Warnier 18 years ago
parent c2d806f962
commit 6fe12504c9
  1. 23
      documentation/changelog.html
  2. 4
      main/exercice/answer.class.php
  3. 25
      main/exercice/question.class.php

@ -76,20 +76,21 @@
<li>The mails sent in exercises tool are sent from the address defined in admin (FS#2712)</li>
<li>"Next" and "Previous" page now works when searching a session (FS#2721)</li>
<li>Fixed bug when launching a quiz with one question per page (FS#2738)</li>
<li>fix a javascript bug with swap menu in ie6 (FS#2815)</li>
<li>Fix a bug in surveys when we want to display answers of an invited person (FS#2731)</li>
<li>Fix a bug when copying a course with surveys. There is now a check for existing surveys with the same code and language (FS#2734)</li>
<li>Fix a bug when seeing matching results in quiz tool (SVN#15987)</li>
<li>Fixed javascript bug with swap menu in ie6 (FS#2815)</li>
<li>Fixed bug in surveys when we want to display answers of an invited person (FS#2731)</li>
<li>Fixed bug when copying a course with surveys. There is now a check for existing surveys with the same code and language (FS#2734)</li>
<li>Fixed bug when seeing matching results in quiz tool (SVN#15987)</li>
<li>Added filtering of SCORM objectives when writing to DB (SVN#16437)</li>
<li>Removed duplication of database write operations for SCORM objectives (SVN#16438)</li>
<li>Fixed HTTP_REFERER bug in ical_export (FS#3041)</li>
<li>Fix a bug in SQL queries for new installs, preventing the creation of the course_module table (FS#3040)</li>
<li>Fix the fact that the password was never sent by e-mail when encrypted, even when it had just been changed for a user, causing a useless e-mail to be sent (SVN#16673)</li>
<li>Fix a bug in users pictures display when using the tuning setting of splitting users dirs (SVN#16673)</li>
<li>Fix a bug in documents picture gallery preventing uppercase image extensions to be seen (SVN#16755)</li>
<li>Fix a bug whereby the repeated agenda items in groups were visible to all (FS#3095)</li>
<li>Fix a bug whereby e-mails sent did not have the standard syntax (SVN#16708)</li>
<li>Fix a bug whereby an empty institution name gave a useless output in the header (SVN#16710)</li>
<li>Fixed bug in SQL queries for new installs, preventing the creation of the course_module table (FS#3040)</li>
<li>Fixed the fact that the password was never sent by e-mail when encrypted, even when it had just been changed for a user, causing a useless e-mail to be sent (SVN#16673)</li>
<li>Fixed bug in users pictures display when using the tuning setting of splitting users dirs (SVN#16673)</li>
<li>Fixed bug in documents picture gallery preventing uppercase image extensions to be seen (SVN#16755)</li>
<li>Fixed bug whereby the repeated agenda items in groups were visible to all (FS#3095)</li>
<li>Fixed bug whereby e-mails sent did not have the standard syntax (SVN#16708)</li>
<li>Fixed bug whereby an empty institution name gave a useless output in the header (SVN#16710)</li>
<li>Fixed bug whereby questions ordering was broken when deleting one question in the middle (SVN#16879)</li>
</ul>
<br />
<h3>CSS changes</h3>

@ -23,7 +23,7 @@
* 5 arrays are created to receive the attributes of each answer belonging to a specified question
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: answer.class.php 15832 2008-07-21 08:02:02Z yannoo $
* @version $Id: answer.class.php 16879 2008-11-23 05:14:43Z yannoo $
*/
@ -64,7 +64,7 @@ class Answer
*/
function Answer($questionId)
{
$this->questionType=$questionType;
//$this->questionType=$questionType;
$this->questionId=$questionId;
$this->answer=array();
$this->correct=array();

@ -1,4 +1,4 @@
<?php // $Id: question.class.php 16865 2008-11-21 23:24:21Z herodoto $
<?php // $Id: question.class.php 16879 2008-11-23 05:14:43Z yannoo $
/*
==============================================================================
@ -28,7 +28,7 @@
* File containing the Question class.
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: question.class.php 16865 2008-11-21 23:24:21Z herodoto $
* @version $Id: question.class.php 16879 2008-11-23 05:14:43Z yannoo $
*/
@ -668,6 +668,16 @@ abstract class Question
{
// deletes the position in the array containing the wanted exercise ID
unset($this->exerciseList[$pos]);
//update order of other elements
$sql = "SELECT question_order FROM $TBL_EXERCICE_QUESTION WHERE question_id='".Database::escape_string($id)."' AND exercice_id='".Database::escape_string($exerciseId)."'";
$res = api_sql_query($sql,__FILE__,__LINE__);
if (Database::num_rows($res)>0) {
$row = Database::fetch_array($res);
if (!empty($row['question_order'])) {
$sql = "UPDATE $TBL_EXERCICE_QUESTION SET question_order = question_order-1 WHERE exercice_id='".Database::escape_string($exerciseId)."' AND question_order > ".$row['question_order'];
$res = api_sql_query($sql,__FILE__,__LINE__);
}
}
$sql="DELETE FROM $TBL_EXERCICE_QUESTION WHERE question_id='".Database::escape_string($id)."' AND exercice_id='".Database::escape_string($exerciseId)."'";
api_sql_query($sql,__FILE__,__LINE__);
@ -693,6 +703,17 @@ abstract class Question
// if the question must be removed from all exercises
if(!$deleteFromEx)
{
//update the question_order of each question to avoid inconsistencies
$sql = "SELECT exercice_id, question_order FROM $TBL_EXERCICE_QUESTION WHERE question_id='".Database::escape_string($id)."'";
$res = api_sql_query($sql,__FILE__,__LINE__);
if (Database::num_rows($res)>0) {
while ($row = Database::fetch_array($res)) {
if (!empty($row['question_order'])) {
$sql = "UPDATE $TBL_EXERCICE_QUESTION SET question_order = question_order-1 WHERE exercice_id='".Database::escape_string($row['exercice_id'])."' AND question_order > ".$row['question_order'];
$res = api_sql_query($sql,__FILE__,__LINE__);
}
}
}
$sql="DELETE FROM $TBL_EXERCICE_QUESTION WHERE question_id='".Database::escape_string($id)."'";
api_sql_query($sql,__FILE__,__LINE__);

Loading…
Cancel
Save