]> git.mjollnir.org Git - moodle.git/commitdiff
Added a question field to numerical table for completeness
authormoodler <moodler>
Thu, 10 Jul 2003 14:09:43 +0000 (14:09 +0000)
committermoodler <moodler>
Thu, 10 Jul 2003 14:09:43 +0000 (14:09 +0000)
mod/quiz/db/mysql.php
mod/quiz/db/mysql.sql
mod/quiz/db/postgres7.php
mod/quiz/db/postgres7.sql
mod/quiz/lib.php
mod/quiz/version.php

index 76ca10186174133ccc978a6662bad208241736f0..e641ca63a14a6a41b78fb4f36398bc410fe539ec 100644 (file)
@@ -92,10 +92,11 @@ function quiz_upgrade($oldversion) {
         table_column("quiz", "", "shuffleanswers", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "shufflequestions");
     }
 
-       if ($oldversion < 2003071000) {
+       if ($oldversion < 2003071001) {
 
         modify_database ("", " CREATE TABLE `prefix_quiz_numerical` (
                                `id` int(10) unsigned NOT NULL auto_increment,
+                               `question` int(10) unsigned NOT NULL default '0',
                                `answer` int(10) unsigned NOT NULL default '0',
                                `min` varchar(255) NOT NULL default '',
                                `max` varchar(255) NOT NULL default '',
index 37d068795cf1e81935090d05177b354d01cc5af5..f20ecd8cdf62c18d042722ad3c12d4f9df806dde 100644 (file)
@@ -222,6 +222,7 @@ CREATE TABLE `prefix_quiz_shortanswer` (
 
 CREATE TABLE `prefix_quiz_numerical` (
   `id` int(10) unsigned NOT NULL auto_increment,
+  `question` int(10) unsigned NOT NULL default '0',
   `answer` int(10) unsigned NOT NULL default '0',
   `min` varchar(255) NOT NULL default '',
   `max` varchar(255) NOT NULL default '',
index 073a86171f61bcbeafe86f0db753f6a8abca9c38..c222b6bc781b449efa4cd55d831b024fa25c463b 100644 (file)
@@ -59,6 +59,16 @@ function quiz_upgrade($oldversion) {
                                );");
         modify_database ("", "CREATE INDEX prefix_quiz_match_question_idx ON prefix_quiz_match (question);");
     }
+    if ($oldversion < 2003071001) {
+        modify_database ("", " CREATE TABLE prefix_quiz_numerical (
+                               id SERIAL PRIMARY KEY,
+                               question integer NOT NULL default '0',
+                               answer integer NOT NULL default '0',
+                               min varchar(255) NOT NULL default '',
+                               max varchar(255) NOT NULL default ''
+                               ); ");
+        modify_database ("", "CREATE INDEX prefix_quiz_numerical_answer_idx ON prefix_quiz_numerical (answer);");
+    }
     return true;
 }
 
index 2a28de3e5baccb2d771d23a079790aaec8df388e..003eab5b9907f6adda89a9dd8c7a9028551c13a3 100644 (file)
@@ -129,6 +129,20 @@ CREATE TABLE prefix_quiz_multichoice (
 # --------------------------------------------------------
 CREATE INDEX prefix_quiz_multichoice_question_idx ON prefix_quiz_multichoice (question);
 
+#
+# Table structure for table quiz_numerical
+#
+
+CREATE TABLE prefix_quiz_numerical (
+  id SERIAL PRIMARY KEY,
+  question integer NOT NULL default '0',
+  answer integer NOT NULL default '0',
+  min varchar(255) NOT NULL default '',
+  max varchar(255) NOT NULL default ''
+);
+# --------------------------------------------------------
+CREATE INDEX prefix_quiz_numerical_answer_idx ON prefix_quiz_numerical (answer);
+
 #
 # Table structure for table quiz_question_grades
 #
index 1a0682a8462c44498cb40fbc5b90a9426b80a0c9..8e7364b300f48ac766755ad6be58a011506a9cba 100644 (file)
@@ -1720,9 +1720,10 @@ function quiz_save_question_options($question) {
                         }
                     } else { // completely new answer
                         unset($options);
-                        $options->min= $question->min[$key];
-                        $options->max= $question->max[$key];
-                        $options->answer= $answer->id;
+                        $options->question = $question->id;
+                        $options->answer = $answer->id;
+                        $options->min = $question->min[$key];
+                        $options->max = $question->max[$key];
                         if (!insert_record("quiz_numerical", $options)) {
                             $result->error = "Could not insert quiz numerical options!";
                             return $result;
index ff93d62157304daebc6263d51b5426f9dc7b7622..fc32d31176379b7ef98a0148f5c3ce8584bd63da 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2003071000;   // The (date) version of this module
+$module->version  = 2003071001;   // The (date) version of this module
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
 ?>