2006-08-14 13:32:39 +00:00
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- Quiz module and question bank table definitions.
|
|
|
|
--
|
|
|
|
-- The tables are grouped divided by:
|
|
|
|
-- quiz/questionbank and definition/runtime.
|
|
|
|
-- --------------------------------------------------------
|
2002-12-15 02:41:07 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- Quiz module, quiz definition data.
|
|
|
|
-- --------------------------------------------------------
|
2002-12-15 02:41:07 +00:00
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_quiz (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
course integer NOT NULL default '0',
|
|
|
|
name varchar(255) NOT NULL default '',
|
|
|
|
intro text NOT NULL default '',
|
|
|
|
timeopen integer NOT NULL default '0',
|
|
|
|
timeclose integer NOT NULL default '0',
|
2005-05-07 00:23:50 +00:00
|
|
|
optionflags integer NOT NULL default '0',
|
|
|
|
penaltyscheme integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
attempts integer NOT NULL default '0',
|
2003-08-23 13:28:32 +00:00
|
|
|
attemptonlast integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
grademethod integer NOT NULL default '1',
|
2005-02-14 18:24:24 +00:00
|
|
|
decimalpoints integer NOT NULL default '2',
|
2003-01-01 13:17:27 +00:00
|
|
|
review integer NOT NULL default '0',
|
2005-01-03 00:41:33 +00:00
|
|
|
questionsperpage integer NOT NULL default '0',
|
2003-04-09 13:57:08 +00:00
|
|
|
shufflequestions integer NOT NULL default '0',
|
|
|
|
shuffleanswers integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
questions text NOT NULL default '',
|
|
|
|
sumgrades integer NOT NULL default '0',
|
|
|
|
grade integer NOT NULL default '0',
|
|
|
|
timecreated integer NOT NULL default '0',
|
2004-06-02 18:03:05 +00:00
|
|
|
timemodified integer NOT NULL default '0',
|
2004-07-07 07:47:33 +00:00
|
|
|
timelimit integer NOT NULL default '0',
|
|
|
|
password varchar(255) NOT NULL default '',
|
2004-12-14 06:43:22 +00:00
|
|
|
subnet varchar(255) NOT NULL default '',
|
2006-02-08 04:41:31 +00:00
|
|
|
popup integer NOT NULL default '0',
|
|
|
|
delay1 integer NOT NULL default '0',
|
|
|
|
delay2 integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
2004-11-19 04:14:13 +00:00
|
|
|
CREATE INDEX prefix_quiz_course_idx ON prefix_quiz (course);
|
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE TABLE prefix_quiz_question_instances (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
2006-08-14 13:32:39 +00:00
|
|
|
quiz integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
question integer NOT NULL default '0',
|
2006-08-14 13:32:39 +00:00
|
|
|
grade integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE INDEX prefix_quiz_question_instances_quiz_idx ON prefix_quiz_question_instances (quiz);
|
|
|
|
CREATE INDEX prefix_quiz_question_instances_question_idx ON prefix_quiz_question_instances (question);
|
2004-11-19 04:14:13 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE TABLE prefix_quiz_question_versions (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
quiz integer NOT NULL default '0',
|
|
|
|
oldquestion integer NOT NULL default '0',
|
|
|
|
newquestion integer NOT NULL default '0',
|
|
|
|
originalquestion integer NOT NULL default '0',
|
|
|
|
userid integer NOT NULL default '0',
|
|
|
|
timestamp integer NOT NULL default '0'
|
|
|
|
);
|
2005-05-07 00:23:50 +00:00
|
|
|
|
2006-08-22 17:31:26 +00:00
|
|
|
CREATE TABLE prefix_quiz_feedback (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
quizid integer NOT NULL default '0',
|
|
|
|
feedbacktext text NOT NULL default '',
|
|
|
|
mingrade real NOT NULL default '0',
|
|
|
|
maxgrade real NOT NULL default '0'
|
|
|
|
);
|
|
|
|
CREATE INDEX prefix_quiz_feedback_quizid_idx ON prefix_quiz_feedback (quizid);
|
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- Quiz module, quiz runtime data.
|
|
|
|
-- --------------------------------------------------------
|
2002-12-15 02:41:07 +00:00
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_quiz_attempts (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
2005-09-19 19:12:35 +00:00
|
|
|
uniqueid integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
quiz integer NOT NULL default '0',
|
2002-12-23 09:39:26 +00:00
|
|
|
userid integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
attempt integer NOT NULL default '0',
|
2006-02-20 09:04:09 +00:00
|
|
|
sumgrades real NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
timestart integer NOT NULL default '0',
|
|
|
|
timefinish integer NOT NULL default '0',
|
2005-05-07 00:23:50 +00:00
|
|
|
timemodified integer NOT NULL default '0',
|
2005-08-15 23:17:58 +00:00
|
|
|
layout text NOT NULL default '',
|
2005-05-07 00:23:50 +00:00
|
|
|
preview integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
2004-11-19 04:14:13 +00:00
|
|
|
CREATE INDEX prefix_quiz_attempts_quiz_idx ON prefix_quiz_attempts (quiz);
|
|
|
|
CREATE INDEX prefix_quiz_attempts_userid_idx ON prefix_quiz_attempts (userid);
|
2006-02-14 02:01:06 +00:00
|
|
|
CREATE UNIQUE INDEX prefix_quiz_attempts_uniqueid_uk ON prefix_quiz_attempts (uniqueid);
|
2004-11-19 04:14:13 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE TABLE prefix_quiz_grades (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
quiz integer NOT NULL default '0',
|
|
|
|
userid integer NOT NULL default '0',
|
|
|
|
grade real NOT NULL default '0',
|
|
|
|
timemodified integer NOT NULL default '0'
|
|
|
|
);
|
2002-12-15 02:41:07 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE INDEX prefix_quiz_grades_quiz_idx ON prefix_quiz_grades (quiz);
|
|
|
|
CREATE INDEX prefix_quiz_grades_userid_idx ON prefix_quiz_grades (userid);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- Questionbank definition data.
|
|
|
|
--
|
|
|
|
-- TODO, these tables no longer belong to the quiz module.
|
|
|
|
-- They should be moved elsewhere when a good home for them
|
|
|
|
-- is found.
|
|
|
|
-- --------------------------------------------------------
|
2002-12-15 02:41:07 +00:00
|
|
|
|
2006-03-01 07:03:57 +00:00
|
|
|
CREATE TABLE prefix_question_categories (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
course integer NOT NULL default '0',
|
|
|
|
name varchar(255) NOT NULL default '',
|
|
|
|
info text NOT NULL default '',
|
2003-08-31 05:57:17 +00:00
|
|
|
publish integer NOT NULL default '0',
|
2005-01-02 15:10:50 +00:00
|
|
|
stamp varchar(255) NOT NULL default '',
|
|
|
|
parent integer NOT NULL default '0',
|
2005-01-10 21:32:44 +00:00
|
|
|
sortorder integer NOT NULL default '999'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
2006-03-01 07:03:57 +00:00
|
|
|
CREATE INDEX prefix_question_categories_course_idx ON prefix_question_categories (course);
|
2004-11-19 04:14:13 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE TABLE prefix_question (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
category integer NOT NULL default '0',
|
|
|
|
parent integer NOT NULL default '0',
|
|
|
|
name varchar(255) NOT NULL default '',
|
|
|
|
questiontext text NOT NULL default '',
|
|
|
|
questiontextformat integer NOT NULL default '0',
|
|
|
|
image varchar(255) NOT NULL default '',
|
2006-09-19 13:35:42 +00:00
|
|
|
generalfeedback text NOT NULL default '',
|
2006-08-14 13:32:39 +00:00
|
|
|
defaultgrade integer NOT NULL default '1',
|
|
|
|
penalty real NOT NULL default '0.1',
|
|
|
|
qtype varchar(20) NOT NULL default '0',
|
|
|
|
length integer NOT NULL DEFAULT '1',
|
|
|
|
stamp varchar(255) NOT NULL default '',
|
|
|
|
version varchar(255) NOT NULL default '',
|
|
|
|
hidden integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
CREATE INDEX prefix_question_category_idx ON prefix_question (category);
|
|
|
|
|
|
|
|
CREATE TABLE prefix_question_answers (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
question integer NOT NULL default '0',
|
|
|
|
answer text NOT NULL default '',
|
|
|
|
fraction real NOT NULL default '0',
|
|
|
|
feedback text NOT NULL default ''
|
|
|
|
);
|
|
|
|
CREATE INDEX prefix_question_answers_question_idx ON prefix_question_answers (question);
|
|
|
|
|
|
|
|
CREATE TABLE prefix_question_numerical_units (
|
|
|
|
id SERIAL8 PRIMARY KEY,
|
|
|
|
question INT8 NOT NULL default '0',
|
|
|
|
multiplier decimal(40,20) NOT NULL default '1.00000000000000000000',
|
|
|
|
unit varchar(50) NOT NULL default ''
|
|
|
|
);
|
|
|
|
CREATE INDEX prefix_question_numerical_units_question_idx ON prefix_question_numerical_units (question);
|
2005-05-07 00:23:50 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE TABLE prefix_question_datasets (
|
|
|
|
id SERIAL8 PRIMARY KEY,
|
|
|
|
question INT8 NOT NULL default '0',
|
|
|
|
datasetdefinition INT8 NOT NULL default '0'
|
|
|
|
);
|
|
|
|
CREATE INDEX prefix_question_datasets_question_datasetdefinition_idx ON prefix_question_datasets (question,datasetdefinition);
|
2005-05-07 00:23:50 +00:00
|
|
|
|
2006-03-12 21:17:42 +00:00
|
|
|
CREATE TABLE prefix_question_dataset_definitions (
|
2005-05-07 00:23:50 +00:00
|
|
|
id SERIAL8 PRIMARY KEY,
|
|
|
|
category INT8 NOT NULL default '0',
|
|
|
|
name varchar(255) NOT NULL default '',
|
|
|
|
type INT8 NOT NULL default '0',
|
|
|
|
options varchar(255) NOT NULL default '',
|
|
|
|
itemcount INT8 NOT NULL default '0'
|
|
|
|
);
|
2006-03-12 21:17:42 +00:00
|
|
|
CREATE INDEX prefix_question_dataset_definitions_category_idx ON prefix_question_dataset_definitions (category);
|
2002-12-15 02:41:07 +00:00
|
|
|
|
2006-03-12 21:17:42 +00:00
|
|
|
CREATE TABLE prefix_question_dataset_items (
|
2005-05-07 00:23:50 +00:00
|
|
|
id SERIAL8 PRIMARY KEY,
|
|
|
|
definition INT8 NOT NULL default '0',
|
2006-09-19 10:56:00 +00:00
|
|
|
itemnumber INT8 NOT NULL default '0',
|
2005-05-07 00:23:50 +00:00
|
|
|
value varchar(255) NOT NULL default ''
|
|
|
|
);
|
2006-03-12 21:17:42 +00:00
|
|
|
CREATE INDEX prefix_question_dataset_items_definition_idx ON prefix_question_dataset_items (definition);
|
2005-05-07 00:23:50 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- Questionbank runtime data.
|
|
|
|
-- See above TODO.
|
|
|
|
-- --------------------------------------------------------
|
2002-12-15 02:41:07 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
CREATE TABLE prefix_question_attempts (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
2006-08-14 13:32:39 +00:00
|
|
|
modulename varchar(20) NOT NULL default 'quiz'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
2004-11-19 04:14:13 +00:00
|
|
|
|
2006-02-15 08:38:41 +00:00
|
|
|
CREATE TABLE prefix_question_sessions (
|
2005-05-07 00:23:50 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
attemptid integer NOT NULL default '0',
|
|
|
|
questionid integer NOT NULL default '0',
|
2005-05-08 10:38:56 +00:00
|
|
|
newest integer NOT NULL default '0',
|
2005-05-07 00:23:50 +00:00
|
|
|
newgraded integer NOT NULL default '0',
|
2006-04-07 05:28:18 +00:00
|
|
|
sumpenalty real NOT NULL default '0',
|
2006-08-24 16:44:15 +00:00
|
|
|
manualcomment text NOT NULL default ''
|
2005-05-07 00:23:50 +00:00
|
|
|
);
|
2006-02-15 08:38:41 +00:00
|
|
|
CREATE UNIQUE INDEX prefix_question_sessions_attempt_idx ON prefix_question_sessions (attemptid,questionid);
|
2005-05-07 00:23:50 +00:00
|
|
|
|
2006-02-28 09:26:00 +00:00
|
|
|
CREATE TABLE prefix_question_states (
|
2005-05-07 00:23:50 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
attempt integer NOT NULL default '0',
|
|
|
|
question integer NOT NULL default '0',
|
|
|
|
originalquestion integer NOT NULL default '0',
|
|
|
|
seq_number integer NOT NULL default '0',
|
2005-08-15 23:17:58 +00:00
|
|
|
answer text NOT NULL default '',
|
2005-05-07 00:23:50 +00:00
|
|
|
timestamp integer NOT NULL default '0',
|
|
|
|
event integer NOT NULL default '0',
|
2006-02-20 09:04:09 +00:00
|
|
|
grade real NOT NULL default '0',
|
|
|
|
raw_grade real NOT NULL default '0',
|
|
|
|
penalty real NOT NULL default '0'
|
2004-08-11 10:27:00 +00:00
|
|
|
);
|
2006-02-28 09:26:00 +00:00
|
|
|
CREATE INDEX prefix_question_states_attempt_idx ON prefix_question_states (attempt);
|
2006-08-22 17:31:26 +00:00
|
|
|
CREATE INDEX prefix_question_states_question_idx ON prefix_question_states (question);
|
2004-08-11 10:27:00 +00:00
|
|
|
|
2006-08-14 13:32:39 +00:00
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- Quiz log actions.
|
|
|
|
-- --------------------------------------------------------
|
2004-08-11 10:27:00 +00:00
|
|
|
|
2006-04-24 08:10:55 +00:00
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'add', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'update', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'view', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'report', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'attempt', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'submit', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'review', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'editquestions', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'preview', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'start attempt', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'close attempt', 'quiz', 'name');
|
|
|
|
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'continue attempt', 'quiz', 'name');
|