Add two new fields for time enforced delay between two quizzes

This commit is contained in:
moodler
2006-02-08 04:41:31 +00:00
parent 401c3496ae
commit cab300a85f
4 changed files with 16 additions and 2 deletions
+7
View File
@@ -869,6 +869,13 @@ function quiz_upgrade($oldversion) {
$record = get_record_sql("SELECT max(id)+1 AS nextid FROM {$CFG->prefix}quiz_attempts");
set_config('attemptuniqueid', empty($record->nextid) ? 1 : $record->nextid);
}
if ($oldversion < 2006020801) {
// add new field to store time delay between the first and second quiz attempt
table_column('quiz', '', 'delay1', 'integer', '10', 'unsigned', '0', 'not null', 'popup');
// add new field to store time delay between the second and any additional quizes
table_column('quiz', '', 'delay2', 'integer', '10', 'unsigned', '0', 'not null', 'delay1');
}
return true;
}
+2
View File
@@ -42,6 +42,8 @@ CREATE TABLE prefix_quiz (
password varchar(255) NOT NULL default '',
subnet varchar(255) NOT NULL default '',
popup tinyint(4) NOT NULL default '0',
delay1 int(10) NOT NULL default '0',
delay2 int(10) NOT NULL default '0',
PRIMARY KEY (id),
KEY course (course)
) TYPE=MyISAM COMMENT='Main information about each quiz';
+4 -1
View File
@@ -968,7 +968,10 @@ function quiz_upgrade($oldversion) {
execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_question_version_id_seq RENAME TO '.$CFG->prefix.'quiz_question_versions_id_seq',false);
execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_question_versions ALTER COLUMN id SET DEFAULT nextval(\''.$CFG->prefix.'quiz_question_versions_id_seq\')',false);
}
if ($oldversion < 2006020801) {
table_column("quiz", "", "delay1", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "popup");
table_column("quiz", "", "delay2", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "delay1");
}
return true;
}
+3 -1
View File
@@ -38,7 +38,9 @@ CREATE TABLE prefix_quiz (
timelimit integer NOT NULL default '0',
password varchar(255) NOT NULL default '',
subnet varchar(255) NOT NULL default '',
popup integer NOT NULL default '0'
popup integer NOT NULL default '0',
delay1 integer NOT NULL default '0',
delay2 integer NOT NULL default '0'
);
CREATE INDEX prefix_quiz_course_idx ON prefix_quiz (course);