Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Matrix Question Type Specification

From MoodleDocs
Revision as of 13:17, 26 February 2009 by Nicolas Connault (talk | contribs) (Adding Likert Scale example)

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.

Some examples

Here are three simple examples of the way this question type could be used. ( ) is mean to be a radio button. [ ] is a checkbox.


Evaluate the following statements:

True False
Moodle is a learning management system (*) ( )
Mahara is an ePortfolio system (*) ( )
Moodle has no bugs ( ) (*)
This proposal is a good idea (*) ( )

Which colours are mixed on your computer's monitor to make each of the listed colours:

Red Green Blue
Red [*] [ ] [ ]
Magenta [*] [ ] [*]
Cyan [ ] [*] [*]
Black [ ] [ ] [ ]
White [*] [*] [*]

Match the adult to their young:

Tadpole Joey Foal Puppy
Poney ( ) ( ) (*) ( )
Frog (*) ( ) ( ) ( )
Kangaroo ( ) (*) ( ) ( )


But the most useful example is probably the Likert Scale:

How often do you do the following?

Never Very rarely Rarely Occasionally Frequently Very Frequently
Brush your teeth [] [ ] [ ] [*] [ ] []
Cook your own dinner [*] [ ] [] [] [ ] []
Make your bed [ ] [] [] [] [ ] [*]
Dye your hair [ ] [ ] [ ] [*] [ ] []
Pick your nose [] [] [*] [] [ ] []

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.
  • NONE - this could be used for example for Likert scales.
field notes
id sequence
questionid fk to mdl_question
multiple boolean
grading (ALL or ANY of WEIGHTED or NONE) 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_cols

Contains the definition of the matrix columns

field notes
id sequence
matrixid fk to question_matrix
shorttext short word to fit in
longtext title or hover or something

question_matrix_rows

Contains the definition of the matrix rows

field notes
id sequence
matrixid fk to question_matrix
shorttext short word to fit in
longtext title or hover or something


question_matrix_weights

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
rowid fk to question_matrix_rows
colid fk to question_matrix_cols
weight percentage value


Student Answer Tables

question_matrix_answers

This table contains a list of all the cells that the student has selected.

field notes
id sequence
rowid fk to question_matrix_rows
colid fk to question_matrix_cols

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.

Penny's TODO

  • Find out about roundzero
  • Find out about constant namespacing in qtypes.