Skip to content

Commit

Permalink
MDL-7567 Numerical questions occasionally mix up the order of their a…
Browse files Browse the repository at this point in the history
…nswers. Merged from MOODLE_16_STABLE.
  • Loading branch information
tjhunt committed Nov 15, 2006
1 parent 806b78f commit 368cc39
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions question/type/numerical/questiontype.php
Expand Up @@ -96,11 +96,11 @@ function get_default_numerical_unit(&$question) {
function save_question_options($question) {

// Get old versions of the objects
if (!$oldanswers = get_records("question_answers", "question", $question->id)) {
if (!$oldanswers = get_records('question_answers', 'question', $question->id, 'id ASC')) {
$oldanswers = array();
}

if (!$oldoptions = get_records("question_numerical", "question", $question->id)) {
if (!$oldoptions = get_records('question_numerical', 'question', $question->id, 'answer ASC')) {
$oldoptions = array();
}

Expand Down Expand Up @@ -193,7 +193,7 @@ function save_question_options($question) {
}

function save_numerical_units($question) {
if (!$oldunits = get_records("question_numerical_units", "question", $question->id)) {
if (!$oldunits = get_records('question_numerical_units', 'question', $question->id, 'id ASC')) {
$oldunits = array();
}

Expand Down Expand Up @@ -424,7 +424,7 @@ function backup($bf,$preferences,$question,$level=6) {

$status = true;

$numericals = get_records("question_numerical","question",$question,"id");
$numericals = get_records('question_numerical', 'question', $question, 'id ASC');
//If there are numericals
if ($numericals) {
//Iterate over each numerical
Expand Down
2 changes: 1 addition & 1 deletion question/type/shortanswer/editquestion.php
Expand Up @@ -5,7 +5,7 @@
$options->usecase = 0;
}
if (!empty($options->answers)) {
$answersraw = get_records_list("question_answers", "id", $options->answers);
$answersraw = get_records_list('question_answers', 'id', $options->answers, 'id ASC');
}

$answers = array();
Expand Down
4 changes: 2 additions & 2 deletions question/type/shortanswer/questiontype.php
Expand Up @@ -37,7 +37,7 @@ function get_question_options(&$question) {
function save_question_options($question) {
$result = new stdClass;

if (!$oldanswers = get_records("question_answers", "question", $question->id, "id ASC")) {
if (!$oldanswers = get_records('question_answers', 'question', $question->id, 'id ASC')) {
$oldanswers = array();
}

Expand Down Expand Up @@ -228,7 +228,7 @@ function backup($bf,$preferences,$question,$level=6) {

$status = true;

$shortanswers = get_records("question_shortanswer","question",$question,"id");
$shortanswers = get_records('question_shortanswer', 'question', $question, 'id ASC');
//If there are shortanswers
if ($shortanswers) {
//Iterate over each shortanswer
Expand Down

0 comments on commit 368cc39

Please sign in to comment.