Need help to retrieve Questions for a particular user

Need help to retrieve Questions for a particular user

by S B -
Number of replies: 0

HI All,

Moodle 3.9

 We are developing a bot for quiz where I wanted to show the quiz questions for a particular user if he has logged in and i am able to check which course he is enrolled in and also the quiz which is mapped to the particular course.

we found a query where the questions we are able to retrieve but it shows the questions if they are at least ones attempted.

How to retrieve questions even without any attempts

Query is as below

SELECT

qa.questionsummary

FROM gxdu_quiz_attempts quiza

JOIN gxdu_question_usages qu ON qu.id = quiza.uniqueid

JOIN gxdu_question_attempts qa ON qa.questionusageid = qu.id

JOIN gxdu_question_attempt_steps qas ON qas.questionattemptid = qa.id

LEFT JOIN gxdu_question_attempt_step_data qasd ON qasd.attemptstepid = qas.id

WHERE quiza.quiz in (SELECT id from gxdu_quiz where name=%s);

Thanks in advance!!

Average of ratings: -