Viewing Question Text

Viewing Question Text

by Mike Keyes -
Number of replies: 1
Is it possible to view the questions that a student had for a quiz? A teacher made a quiz with random questions and now he would like to see the questions his students were asked. I know a teacher can view questions for one student at a time but what about the entire class? Can this be done be querying the database?
Average of ratings: -
In reply to Mike Keyes

Re: Viewing Question Text

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There is no easy way to do this inside Moodle.

The way the selection of random questions used in the quiz is stored in the database is really horrible, and I would love to change it one day, but doing so would be a huge cahange, so I keep putting it off until later. sad

In the quiz, different types of report are plugins, so if you can work out the right database query, it should then be quite easy to wrap it up in some PHP code and make a nicely formatted report for teachers to see.

The following SQL may help you get started. The ON condition on that last join is what I mean by really horrible.
SELECT *
FROM m_quiz_attempts qa
JOIN m_question_sessions sess ON qa.uniqueid = sess.attemptid
JOIN m_question_states st ON st.id = sess.newgraded
JOIN m_question randq ON randq.id = sess.questionid AND randq.qtype = 'random'
JOIN m_question actualq ON st.answer LIKE 'random' || actualq.id || '-%';
Development:Quiz_database_structure may help too.