Development:Matrix Question Type Specification
Introduction
I need to develop a n:n matching type of question that is suited to a matrix. The teacher should be able to define the matrix and the various grading options.
The follow serves as my very high level (mostly technical) specification.
Database Tables
Question Definition Tables
question_matrix
Contains basic information about the matrix - what the grading method and whether multiple checks per row are supported(eg checkboxes vs radio buttons) The grading methods translate to:
- ALL - the student must select ALL correct answers and get 100%, else 0%.
- ANY - the student must select at least one of the correct answers, and get 100% else 0%.
- WEIGHTED - each cell has a weighting from -100% to 100%. The "correct"
answers must add up to 100%, but the 0 and negative ones don't have any constraint on them.
field | notes |
---|---|
id | sequence |
question | fk to mdl_question (or mdl_question_instances) |
multiple | boolean |
grading | (ALL or ANY of WEIGHTED) enum or fk to another table containing these values. |
roundzero | If the total for the question is less than 0, set it to 0. (This can be triggered by highly negative weights) |
renderer | 'matrix' hardcoded at the moment (see implementation notes) |
question_matrix_option
Contains the definition of the matrix.
field | notes |
---|---|
id | sequence |
matrix | fk to question_matrix |
shorttext | short word to fit in |
longtext | title or hover or something |
xory | enum (x, y) |
question_matrix_weight
Contains more information about how each cell should be graded. EVERY cell should have an entry in this table. When the grading method is 'all' or 'any', the 'correct' answers will be stored here as a non-zero percentage automatically and the non-correct answers will be zero.
field | notes |
---|---|
id | sequence |
x | fk to question_matrix_option |
y | fk to question_matrix_option |
weight | percentage value |
Student Answer Tables
question_matrix_answer
This table contains a list of all the cells that the student has selected.
field | notes |
---|---|
id | sequence |
x | fk to question_matrix_option |
y | fk to question_matrix_option |
Implementation notes
Grading
There should be classes to match the grading types (all or any or weighted) so that new options could be written.
Renderers
It may make sense for some point for some different method to be used to render this to the user, so we can start with a matrix class and maybe add more later if necessary.