When editing some question types, the options get jumbled up.

This commit is contained in:
tjhunt 2007-01-29 12:35:29 +00:00
parent 2c08b2514c
commit f07d1d3197
6 changed files with 10 additions and 12 deletions

View File

@ -60,7 +60,8 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
c.correctanswerlength, c.id AS calcid
FROM {$CFG->prefix}question_answers a,
{$CFG->prefix}question_calculated c
WHERE c.question = $question->id AND a.id = c.answer")) {
WHERE c.question = $question->id AND a.id = c.answer
ORDER BY a.id ASC")) {
$oldanswers = array();
}

View File

@ -13,7 +13,7 @@ class question_match_qtype extends default_questiontype {
function get_question_options(&$question) {
$question->options = get_record('question_match', 'question', $question->id);
$question->options->subquestions = get_records("question_match_sub", "question", $question->id, "id ASC" );
$question->options->subquestions = get_records('question_match_sub', 'question', $question->id, 'id ASC');
return true;
}
@ -110,8 +110,7 @@ class question_match_qtype extends default_questiontype {
}
function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) {
if (!$state->options->subquestions = get_records('question_match_sub',
'question', $question->id)) {
if (!$state->options->subquestions = get_records('question_match_sub', 'question', $question->id, 'id ASC')) {
notify('Error: Missing subquestions!');
return false;
}
@ -147,8 +146,7 @@ class question_match_qtype extends default_questiontype {
$responses = array_map(create_function('$val',
'return explode("-", $val);'), $responses);
if (!$questions = get_records('question_match_sub',
'question', $question->id)) {
if (!$questions = get_records('question_match_sub', 'question', $question->id, 'id ASC')) {
notify('Error: Missing subquestions!');
return false;
}
@ -416,7 +414,7 @@ class question_match_qtype extends default_questiontype {
$status = true;
$matchs = get_records("question_match_sub","question",$question,"id");
$matchs = get_records('question_match_sub', 'question', $question, 'id ASC');
//If there are matchs
if ($matchs) {
$status = fwrite ($bf,start_tag("MATCHS",6,true));

View File

@ -28,7 +28,7 @@ class embedded_cloze_qtype extends default_questiontype {
return false;
}
$wrappedquestions = get_records_list('question', 'id', $sequence);
$wrappedquestions = get_records_list('question', 'id', $sequence, 'id ASC');
// We want an array with question ids as index and the positions as values
$sequence = array_flip(explode(',', $sequence));

View File

@ -271,8 +271,7 @@ class default_questiontype {
$question->options = new object;
}
// The default implementation attaches all answers for this question
$question->options->answers = get_records('question_answers', 'question',
$question->id);
$question->options->answers = get_records('question_answers', 'question', $question->id, 'id ASC');
return true;
}

View File

@ -136,7 +136,7 @@
if ($types) {
foreach ($types as $type) {
if (!$servers = get_records('question_rqp_servers', 'typeid', $type->id)) {
if (!$servers = get_records('question_rqp_servers', 'typeid', $type->id, 'id ASC')) {
delete_records('question_rqp_types', 'id', $type->id);
} else {
foreach ($servers as $server) {

View File

@ -102,7 +102,7 @@ class question_truefalse_qtype extends default_questiontype {
return false;
}
// Load the answers
if (!$question->options->answers = get_records('question_answers', 'question', $question->id)) {
if (!$question->options->answers = get_records('question_answers', 'question', $question->id, 'id ASC')) {
notify('Error: Missing question answers!');
return false;
}