Development:Calculated question type: Difference between revisions
Helen Foster (talk | contribs) m (category edit) |
(Flagging this article as Obsolete design) |
||
Line 1: | Line 1: | ||
{{obsolete_design}} | |||
{{Questiontype developer docs}} | {{Questiontype developer docs}} | ||
{{Calculated question dev docs}} | {{Calculated question dev docs}} |
Latest revision as of 14:25, 10 October 2008
The person who knows most about this question type is probably Pierre Pichet.
Database tables
quiz_calculated
The quiz_calculated table is an extension to the quiz_questions table by the calculated questiontype. However, it would be more suitable to change that to be an extension of the quiz_answers table, which, from a data perspective, is already possible, since an answer id is stored in the answer field. The questiontype code would need some changes to take this into account, however.
- id
- int(10) unsigned NOT NULL auto_increment,
- question
- int(10) unsigned NOT NULL default '0',
- answer
- int(10) unsigned NOT NULL default '0',
- 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',
quiz_numerical_units
The calculated question type shares the quiz_numerical_units table with the numerical question type.
Response storage
The calculated questiontype inherits its methods create_session_and_responses(), restore_session_and_responses() and save_session_and_responses() from the abstract dataset dependent questiontype. This questiontype serializes the information of the chosen dataset together with the (single) response value into a string of the format datasetXX-RESPONSE, where dataset is the actual string "dataset", XX is the number of the chosen dataset item and RESPONSE is the value that was received from the submitted form.