]> git.mjollnir.org Git - moodle.git/commitdiff
Updating database and backup/restore in order to make it possible
authorkaipe <kaipe>
Sun, 5 Dec 2004 12:56:01 +0000 (12:56 +0000)
committerkaipe <kaipe>
Sun, 5 Dec 2004 12:56:01 +0000 (12:56 +0000)
for teachers to choose number of decimals for calculated questions.
Can someone please check if the database update for postgres7 turns out alright?

mod/quiz/backuplib.php
mod/quiz/db/mysql.php
mod/quiz/db/mysql.sql
mod/quiz/db/postgres7.php
mod/quiz/db/postgres7.sql
mod/quiz/restorelib.php
mod/quiz/version.php

index a8da7ee5f155a9c4238565bd1b6debe3cc1d0059..ef181d58fdbca27ed475d2ea7a3cb2d3ba73cdfd 100644 (file)
                 fwrite ($bf,full_tag("TOLERANCE",$level+1,false,$calculated->tolerance));
                 fwrite ($bf,full_tag("TOLERANCETYPE",$level+1,false,$calculated->tolerancetype));
                 fwrite ($bf,full_tag("CORRECTANSWERLENGTH",$level+1,false,$calculated->correctanswerlength));
+                fwrite ($bf,full_tag("CORRECTANSWERFORMAT",$level+1,false,$calculated->correctanswerformat));
                 //Now backup numerical_units
                 $status = quiz_backup_numerical_units($bf,$preferences,$question,7);
                 //Now backup required dataset definitions and items...
index f0b4424c373dbb2ef169f8695c85f4d0aabfe134..f0bcbf3a49f793a3ef45108855950df1d2d01bc8 100644 (file)
@@ -288,6 +288,10 @@ function quiz_upgrade($oldversion) {
         modify_database('','ALTER TABLE prefix_quiz_numerical_units ADD INDEX question (question);');
         modify_database('','ALTER TABLE prefix_quiz_questions ADD INDEX category (category);');
     }
+
+    if ($oldversion < 2004120501) {
+        table_column("quiz_calculated", "", "correctanswerformat", "integer", "10", "", "2", "not null", "correctanswerlength");
+    }
     
     return true;
 }
index 105ee75c300142c081c82b76aff59976c6997043..62ecb57d70f0caea9ec98ec5e2d350499b02526a 100644 (file)
@@ -100,6 +100,7 @@ CREATE TABLE `prefix_quiz_calculated` (
   `tolerance` varchar(20) NOT NULL default '0.0',
   `tolerancetype` int(10) NOT NULL default '1',
   `correctanswerlength` int(10) NOT NULL default '2',
+  `correctanswerformat` int(10) NOT NULL default '2',
   PRIMARY KEY  (`id`),
   KEY `question` (`question`),
   KEY `answer` (`answer`)
index ea1d496945434a25e34d5474ab47640c76fa14d6..89b61ed436ca62ee54a6aac5056255963523dcfa 100644 (file)
@@ -274,6 +274,10 @@ function quiz_upgrade($oldversion) {
         modify_database('','ALTER TABLE prefix_quiz_attemptonlast_datasets ADD CONSTRAINT prefix_quiz_category_userid_unique UNIQUE (category,userid);');
     }
 
+    if ($oldversion < 2004120501) {
+        table_column("quiz_calculated", "", "correctanswerformat", "integer", "10", "", "2", "not null", "correctanswerlength");
+    }
+
     return true;
 }
 
index 68c2270d8399e6bcd7ae23a2a24812070acfba23..5a5be530481f6e3e4d7ccdba06ee172f650a79b4 100644 (file)
@@ -327,7 +327,8 @@ CREATE TABLE prefix_quiz_calculated (
     answer INT8  NOT NULL default '0',
     tolerance varchar(20) NOT NULL default '0.0',
     tolerancetype INT8 NOT NULL default '1',
-    correctanswerlength INT8 NOT NULL default '2'
+    correctanswerlength INT8 NOT NULL default '2',
+    correctanswerformat INT8 NOT NULL default '2'
 );
 
 CREATE INDEX prefix_quiz_calculated_question_idx 
index ac2d9b8e56e2b00229b8c8031ad3e430110637ed..d55a92a921500291adfbb79386cfa476e9898f74 100644 (file)
             $calculated->tolerance = backup_todb($cal_info['#']['TOLERANCE']['0']['#']);
             $calculated->tolerancetype = backup_todb($cal_info['#']['TOLERANCETYPE']['0']['#']);
             $calculated->correctanswerlength = backup_todb($cal_info['#']['CORRECTANSWERLENGTH']['0']['#']);
+            $calculated->correctanswerformat = backup_todb($cal_info['#']['CORRECTANSWERFORMAT']['0']['#']);
 
             ////We have to recode the answer field
             $answer = backup_getid($restore->backup_unique_code,"quiz_answers",$calculated->answer);
index ea700c8373ae01e88c580681ce44f1edf32cf0be..c6f043845c7be931ac4be18de4ec28297d5c57ab 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2004112300;   // The (date) version of this module
+$module->version  = 2004120501;   // The (date) version of this module
 $module->requires = 2004112300;   // Requires this Moodle version
 $module->cron     = 0;            // How often should cron check this module (seconds)?