]> git.mjollnir.org Git - moodle.git/commitdiff
Removed the answershuffle field from the random short answer question because in...
authorgustav_delius <gustav_delius>
Fri, 28 Apr 2006 09:44:13 +0000 (09:44 +0000)
committergustav_delius <gustav_delius>
Fri, 28 Apr 2006 09:44:13 +0000 (09:44 +0000)
question/type/randomsamatch/db/mysql.php
question/type/randomsamatch/db/mysql.sql
question/type/randomsamatch/db/postgres7.php
question/type/randomsamatch/db/postgres7.sql
question/type/randomsamatch/editquestion.html
question/type/randomsamatch/editquestion.php
question/type/randomsamatch/questiontype.php
question/type/randomsamatch/version.php

index 86a8c00aaad43e1fcc9cbaeb5b1e46e9c1974d46..b57d42ff8b1e2e0a8a8affe041e8816d932c62b6 100644 (file)
@@ -5,6 +5,10 @@
 function qtype_randomsamatch_upgrade($oldversion=0) {
     global $CFG;
 
+    if ($oldversion < 2006042800) {
+        // This is a random questiontype and therefore answers are always shuffled, no need for this field
+        modify_database('', 'ALTER TABLE prefix_question_randomsamatch DROP shuffleanswers');
+    }
     return true;
 }
 
index 43a8c535647c0ceca87ba0e62e406ade551abf12..79d8b4d45c913868c949fd0817034a1407a64293 100644 (file)
@@ -6,7 +6,6 @@ CREATE TABLE prefix_question_randomsamatch (
   id int(10) unsigned NOT NULL auto_increment,
   question int(10) unsigned NOT NULL default '0',
   choose int(10) unsigned NOT NULL default '4',
-  shuffleanswers tinyint(4) NOT NULL default '1',
   PRIMARY KEY  (id),
   KEY question (question)
 ) TYPE=MyISAM COMMENT='Info about a random short-answer matching question';
index fe37c48afa21da7dc19d0f65535a8f0c5fff088e..734594fcc1a81a540954961db89e19dc7adace25 100644 (file)
@@ -5,6 +5,11 @@
 function qtype_randomsamatch_upgrade($oldversion=0) {
     global $CFG;
 
+    if ($oldversion < 2006042800) {
+        // This is a random questiontype and therefore answers are always shuffled, no need for this field
+        modify_database('', 'ALTER TABLE prefix_question_randomsamatch DROP shuffleanswers');
+    }
+
     return true;
 }
 
index ac9392778aa2162f0a1a9fc00caae310ab2210c6..67fa91e45c18babf70f9fcbcc0d09a73689f955d 100644 (file)
@@ -9,7 +9,6 @@ CREATE TABLE prefix_question_randomsamatch (
   id SERIAL PRIMARY KEY,
   question integer NOT NULL default '0',
   choose integer NOT NULL default '4',
-  shuffleanswers integer NOT NULL default '1'
 );
 
 CREATE INDEX prefix_question_randomsamatch_question_idx ON prefix_question_randomsamatch (question);
index 8f0aa4a151c478de0e4baa0ac63bd52d3e6b0fdc..1f03ace3054574be4f0b33da78167c9775c2db07 100644 (file)
      ?>
     </td>
 </tr>
-<tr valign="top">
-    <td align="right"><b><?php print_string("shuffle", "quiz") ?>:</b></td>
-     <td align="left">
-    <?php
-        choose_from_menu($yesnooptions, "shuffleanswers", "$options->shuffleanswers", "");
-        helpbutton("matchshuffle", get_string("shuffle","quiz"), "quiz");
-     ?>
-    </td>
-</tr>
 <?php
     $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
     $QTYPES[$question->qtype]->print_question_form_end($question);
index cdd93f1781d98c1bade5085a4205348f2bea8d4b..f39f7d2f14e3e17e9ddf222b722e25ec0596c56e 100644 (file)
@@ -3,7 +3,6 @@
         $options = get_record("question_randomsamatch", "question", $question->id);
     } else {
         $options->choose = "";
-        $options->shuffleanswers = 1;
     }
     $saquestions = $QTYPES['randomsamatch']->get_sa_candidates($category->id);
     $numberavailable = count($saquestions);
index d3d214a6a03d9dedc46642b22748e9758951c69f..21f16fd94bd416cfcdd77c8b4a643070ef107a19 100644 (file)
@@ -32,7 +32,6 @@ class question_randomsamatch_qtype extends question_match_qtype {
     function save_question_options($question) {
         $options->question = $question->id;
         $options->choose = $question->choose;
-        $options->shuffleanswers = $question->shuffleanswers;
 
         if (2 > $question->choose) {
             $result->error = "At least two shortanswer questions need to be chosen!";
@@ -150,12 +149,10 @@ class question_randomsamatch_qtype extends question_match_qtype {
             $state->options->subquestions[$key] = clone($wrappedquestion);
         }
 
-        // Shuffle the answers if required
+        // Shuffle the answers (Do this always because this is a random question type)
         $subquestionids = array_values(array_map(create_function('$val',
          'return $val->id;'), $state->options->subquestions));
-        if ($cmoptions->shuffleanswers and $question->options->shuffleanswers) {
-           $subquestionids = swapshuffle($subquestionids);
-        }
+        $subquestionids = swapshuffle($subquestionids);
 
         // Create empty responses
         foreach ($subquestionids as $val) {
@@ -261,7 +258,6 @@ class question_randomsamatch_qtype extends question_match_qtype {
                 $status = fwrite ($bf,start_tag("RANDOMSAMATCH",6,true));
                 //Print randomsamatch contents
                 fwrite ($bf,full_tag("CHOOSE",7,false,$randomsamatch->choose));
-                fwrite ($bf,full_tag("SHUFFLEANSWERS",7,false,$randomsamatch->shuffleanswers));
                 $status = fwrite ($bf,end_tag("RANDOMSAMATCH",6,true));
             }
         }
@@ -289,7 +285,6 @@ class question_randomsamatch_qtype extends question_match_qtype {
             //Now, build the question_randomsamatch record structure
             $randomsamatch->question = $new_question_id;
             $randomsamatch->choose = backup_todb($ran_info['#']['CHOOSE']['0']['#']);
-            $randomsamatch->shuffleanswers = backup_todb($ran_info['#']['SHUFFLEANSWERS']['0']['#']);
 
             //The structure is equal to the db, so insert the question_randomsamatch
             $newid = insert_record ("question_randomsamatch",$randomsamatch);
index 2d2a8d9fa7fe95d4af7d3dab8617390b017d0b62..d1384a822edc01bd687089a7b8365c85c3813c21 100644 (file)
@@ -1,6 +1,6 @@
 <?PHP // $Id$
 
-$plugin->version  = 2006032200;
+$plugin->version  = 2006042800;
 $plugin->requires = 2006032200;
 
 ?>