Abolished the qtype integers. The question types are now indexed by their name as specified by their directory name. This will avoid a lot of confusion in future when we have plugable question types.

This commit is contained in:
gustav_delius 2006-03-21 23:08:36 +00:00
parent 069b6daf76
commit 6040798269
6 changed files with 47 additions and 15 deletions

View file

@ -972,6 +972,22 @@ function quiz_upgrade($oldversion) {
execute_sql("ALTER TABLE {$CFG->prefix}quiz_essay_states RENAME {$CFG->prefix}question_essay_states", false);
}
if ($oldversion < 2006032100) {
table_column('question', 'qtype', 'qtype', 'varchar', 20, '', '', 'not null');
set_field('question', 'qtype', 'shortanswer', 'qtype', 1);
set_field('question', 'qtype', 'truefalse', 'qtype', 2);
set_field('question', 'qtype', 'multichoice', 'qtype', 3);
set_field('question', 'qtype', 'random', 'qtype', 4);
set_field('question', 'qtype', 'match', 'qtype', 5);
set_field('question', 'qtype', 'randomsamatch', 'qtype', 6);
set_field('question', 'qtype', 'description', 'qtype', 7);
set_field('question', 'qtype', 'numerical', 'qtype', 8);
set_field('question', 'qtype', 'multianswer', 'qtype', 9);
set_field('question', 'qtype', 'calculated', 'qtype', 10);
set_field('question', 'qtype', 'rqp', 'qtype', 11);
set_field('question', 'qtype', 'essay', 'qtype', 12);
}
return true;
}

View file

@ -392,7 +392,7 @@ CREATE TABLE prefix_question (
image varchar(255) NOT NULL default '',
defaultgrade int(10) unsigned NOT NULL default '1',
penalty float NOT NULL default '0.1',
qtype smallint(6) NOT NULL default '0',
qtype varchar(20) NOT NULL default '',
length int(10) unsigned NOT NULL default '1',
stamp varchar(255) NOT NULL default '',
version int(10) NOT NULL default '1',

View file

@ -1141,6 +1141,22 @@ function quiz_upgrade($oldversion) {
}
if ($oldversion < 2006032100) {
table_column('question', 'qtype', 'qtype', 'varchar', 20, '', '', 'not null');
set_field('question', 'qtype', 'shortanswer', 'qtype', 1);
set_field('question', 'qtype', 'truefalse', 'qtype', 2);
set_field('question', 'qtype', 'multichoice', 'qtype', 3);
set_field('question', 'qtype', 'random', 'qtype', 4);
set_field('question', 'qtype', 'match', 'qtype', 5);
set_field('question', 'qtype', 'randomsamatch', 'qtype', 6);
set_field('question', 'qtype', 'description', 'qtype', 7);
set_field('question', 'qtype', 'numerical', 'qtype', 8);
set_field('question', 'qtype', 'multianswer', 'qtype', 9);
set_field('question', 'qtype', 'calculated', 'qtype', 10);
set_field('question', 'qtype', 'rqp', 'qtype', 11);
set_field('question', 'qtype', 'essay', 'qtype', 12);
}
return true;
}

View file

@ -382,7 +382,7 @@ CREATE TABLE prefix_question (
image varchar(255) NOT NULL default '',
defaultgrade integer NOT NULL default '1',
penalty real NOT NULL default '0.1',
qtype integer NOT NULL default '0',
qtype varchar(20) NOT NULL default '0',
length integer NOT NULL DEFAULT '1',
stamp varchar(255) NOT NULL default '',
version integer NOT NULL default '1',

View file

@ -5,7 +5,7 @@
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2006031202; // The (date) version of this module
$module->version = 2006032100; // The (date) version of this module
$module->requires = 2006022400; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?