Every Question attempted by a student

Re: Every Question attempted by a student

by Arvind Murali -
Number of replies: 1
Randy, just realized something. The quiz attempts unique id naturally only tracks quizzes that the user took. I'm tying all forms of modules that engaged with questions through the question_attempts table. So I'd need to figure out a way to restrict to course with info from the question attempt table which is what led me to the contextid. I am writing a custom block for course context, so an alternate idea I had was to get the current courseid, pull all the modules from within the course through some method ( I'm yet to look it up). Then iterate on all the question attempts that had the context id of that using an sql query. Thoughts?
In reply to Arvind Murali

Re: Every Question attempted by a student

by Randy Thornton -
Picture of Documentation writers
Arvind,

I think it will depend on the way each of those other modules connects to the question_attempts table. If a module uses the same method as the quiz and so question_usages.uniqueid leads you back to the module, then you can use the same method as with the quiz.

However, if the module use other methods, such as skipping the question_usages table entirely, then, yes, as you say, you may need to go through the contextid.

Modules may do this in ways very different from the way the quiz does it. So, how many ways are there for a module to use the question_usages and question_attempts tables?

I can't speak to the API here, since I don't know how it works, but if I were doing such a report in just SQL, I would first write a separate query for each module to get the results. Then I would understand each method. Then I would put them together into one report.