DB relationship between question bank and random quiz

DB relationship between question bank and random quiz

Melvin Richard -
回帖数:3

Hello All,


I have a question bank with 20 questions &  I have a quiz which takes randomly 10 questions from  that question bank. 

There are 2 short answers in that question bank, I don't know which users have got the short answers type questions (one might get no short answer question, other might get one, other might get two).

Is there a db relationship through which I can find this out? 



回复Melvin Richard

Re: DB relationship between question bank and random quiz

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

Before looking in the DB, you could first try Results -> Responses in the quiz administration. Turn on display question text, or whatever that option is called.

To get the information you want, see https://docs.moodle.org/dev/Overview_of_the_Moodle_question_engine#Database_tables particularly the example database query just after that section.

回复Tim Hunt

Re: DB relationship between question bank and random quiz

Melvin Richard -

Hello Tim,

Thanks for your reply. But I need to know from which table I will find whether the response of a particular question of a student is right or wrong.

In "questions_attempts" table, I am able to see each persons attempt individually,  with the help of the "question_id" column I am able to find which question from question bank has been assigned also. But I couldn't find whether their response is right or wrong.

Could you please help me on this.

回复Melvin Richard

Re: DB relationship between question bank and random quiz

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

That query includes

qas.state,
qas.fraction,

State should be self-explanatory.

Fraction is the mark on a scale of 0..1. It gets multiplied by qa.maxmark.

The only tricky bit is that there can be mulitple steps for each qa, and you need to take the one with the largest qas.sequencenumber,