Note:

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

File storage conversion Quiz and Questions: Difference between revisions

From MoodleDocs
Line 74: Line 74:
* Missing type
* Missing type
* Numerical
* Numerical
The new 2,0 number and unit grading use a new table question_numerical_options where the instructions field is HTML which could include images.
This table is also used by calculated and calculated simple.
Pierre Pichet 08:11, 23 May 2010 (UTC)
* Random
* Random
* Random short-answer matching
* Random short-answer matching
* Short answer
* Short answer
* True-false
* True-false


====Match====
====Match====

Revision as of 08:20, 23 May 2010

This page are some notes about what has to be done for MDL-16094.

I have chosen to write this document with reference to database columns, with secondary mention of the editing forms where the value is edited. That determines what itemid should be used with each file area.

I would like to review code changes before they are committed for all of this, but I can't see myself having time to do much work on this, only to help someone else do it.


Assumptions

I believe it is the case that each HTML editor on a form has to use a separate HTML editor (otherwise copying files to and from draft areas does not work). However, for question types, I don't think that leads to the best usability.

Similarly, each HTML editor has to have a corresponding ...format field (like questiontext, questiontextformat) even though it is stupid (from a usability point of view) for different parts of a question to use different formats.


Issues

As well as the issues implicit in the assumptions above, there is also the issue that many of the images belong to a particular question. However, whether the image should be visible to a particular user at a particular time, is a decision that can only be made by the module that is using the question. Currently there are two 'modules' that use questions: the quiz module, and the core question preview. We probably need some sort of callback API to control the serving of files. I don't have a good solution for that, but I am very happy to talk about it.

The quiz

Quiz database structure

  • We need a file area for quiz.intro.
  • We need a file area for quiz_feedback.feedbacktext. (The overall feedback on the quiz settings form.) If it is possible to do easily, we should replace the overall feedback boxes with HTML editors (the boxes currently accept HTML input into text fields, which is functionally complete, but sucky).
  • We need to add a feedbacktextformat column, if it has not already been done.
  • Ideally, access to overall feedback files should be controlled by the same logic as whether the feedback itself is displayed. However, I think it would be acceptable to release Moodle 2.0 without this. Just leave an open tracker issue assigned to me, and I can implement that check later.

No other quiz_... tables have files associated with any columns.


Questions

Question database structure

There are no fields in the 'question engine' tables that have files. Except:

  • There should be a question_sessions.manualcommentformat column. (But manual comment should not support attached files.)

All the issues are in the 'question bank' part, which means the core question bank, and the all the question type plugins.


Core question bank

  • I think that question_categories.info (which is HTML) should not have files. However, we need a question_categories.infoformat field.
  • We need file areas for question.questiontext and question.generalfeedback. We also need to add the missing question.generalfeedbackformat field.
  • We need file areas, and ...format columns for question_answers.answer and question_answers.feedback. (Depending on the question type, question_answers.answer may be HTML, or it may not, but where it is not, we will force the ...format value to something appropriate. Anyway, as an example, answers are HTML for multichoice and truefalse, but not for numerical or shortanswer.)
  • We must get rid of the question.image column. We need an upgrade to:
    1. Do a database upgrade that appends an img tag to the questiontext, if the img column is not empty;
    2. and copy the file into the right file area;
    3. then drop the question.image column;
    4. remove that field from all editing forms;
    5. remove the places where the image is displayed.

Note that all the above changes require changes to the question editing form for all question types, but hopefully that can mostly be done in the form base class.

  • Question import needs to use the file-picker.
  • Question export should be changed to put the files in an appropriate file area. I am not sure what the best file area is right now. MDL-15573

Question types

Question types where nothing needs to be done

These only use the core question tables, or do not need files associated with their own tables.

  • Description
  • Essay
  • Missing type
  • Numerical

The new 2,0 number and unit grading use a new table question_numerical_options where the instructions field is HTML which could include images.

This table is also used by calculated and calculated simple.

Pierre Pichet 08:11, 23 May 2010 (UTC)

  • Random
  • Random short-answer matching
  • Short answer
  • True-false

Match

  • question_match_sub.questiontext needs a ...format column and a file area. (answertext does not. It is displayed in a select menu.)


Multiple choice

  • correctfeedback, partiallycorrectfeedback and incorrectfeedback all need ...format columns and a file area.
  • The choice entry boxes on the editing form should be changed to HTML editors.

Question types I am not really sure about

  • Calculated* - I don't really know what Pierre is doing here. I need to get my head round it.

So here is the status of calculated in 2,0.

The calculatedsimple is just a regular calculated that can be edited in a one page because it is not using the shared category datasets. In both on them there is no new field with image to store other than question text and answer feedback.

The answer field is just math formula i.e. plain text.

The multichoice calculated is a multichoice where calculated math formula can be inserted {=...} so the requirements are the same as regular multichoice.

Regular calculated and multichoice calculated used the new table question_calculated_options although regular calculated only used the synchronize field, multichoice calculated using the other fields. I prefer to use only one new table and the fields for multichoice calculated are a copy of most of the multichoice ones.

This is a new table in 2,0 so no file conversion.

Pierre Pichet 08:01, 23 May 2010 (UTC)


  • Multi-answer - probably does not need any other file areas, but the code may need fixing a bit.

So here is the status of Multi-answer in 2,0.

Multi-answer code is the same has in 1.9, the improvements has been on the data validation in the edit_form with additional warnings when the user modify the number or question type in the question text peculiarly when the question has attempts stored.

I am working on the lang strings.

Pierre Pichet 08:01, 23 May 2010 (UTC)

  • Numerical

The new 2,0 number and unit grading use a new table question_numerical_options where the instructions field is HTML which could include images.

This table is also used by calculated and calculated simple.

Pierre Pichet 08:11, 23 May 2010 (UTC)

For the future

As in, Moodle 2.1 or later.

  • Support files in student responses and manual comments.


See also

  • MDL-16094
  • Feel free to discuss this with Tim Hunt.