Adding to new column to mdl_question_attempts table

Adding to new column to mdl_question_attempts table

by Kishore Babu M. N. -
Number of replies: 2

Hi, In the process of adding some new functionality to quiz module, I am planning to add a new field 'vistied' similar to 'flagged' field in mdl_question_attempts table. As I have little experience in moodle, can any one help me in answering the following:

1. Is it recommendable to make database changes as this (like adding new fields to the tables), will it cause the break down of moodle working functionality in any manner?

2. Is there any reference document for me to follow how to add new columns to  moodle tables particularly to quiz and questions related database tables?

3. I could not able to locate mdl_question_attempts table creation location. For example for quiz_attempts table I could able to find table structure in mod/quiz/db/install.xml. However I could not able to find similar file for mdl_question_attempts

Thanks in advance.

Regards,

M. N. Kishore Babu.

Average of ratings: -
In reply to Kishore Babu M. N.

Re: Adding to new column to mdl_question_attempts table

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

1. This sort of thing is not recommended. It probably won't break anything  in the short term, but it will cause you problem during future upgrades.

3. The question system is a core subsystem, not specific to the quiz, so these tables are defined in lib/db.

What are you actually trying to do? Not that moodle intentionally does not track which questions the student has looked at. It tracks whether they have input a response. Anyway, you could probably track visited questions by making a new question behaviour plugin.

Alternatively, you could modify the quiz, and track which pages of the quiz have been visited, rather than tracking by question.

In reply to Tim Hunt

Re: Adding to new column to mdl_question_attempts table

by Kishore Babu M. N. -

Thanks Tim for the reply. For me the requirement is,  I need to distinguish the question status in a quiz that are

1. visited and not given response

2. not visited and not given response.

I am trying to accomplish this.  I try both the options that you have suggested.

Thank you very much.

Regards,

M. N. Kishore Babu.