Time spent on each quiz question in Moodle 4.5 and 5.x

Moodle shows only the time for a whole quiz attempt. Our free quiz_questiontime report shows how long students spent on each question, from the site log.

Drawing of a student turning the pages of a large test at a desk, with a cobalt stopwatch pinned to the corner of each page.

Short answer: Moodle’s quiz reports show how long a whole attempt took, not each question. Our free report, Time on questions (quiz_questiontime), adds a page under Quiz > Results with the median time on each question, the middle half of attempts, and every attempt’s time per question, downloadable as CSV or Excel. It works on Moodle 4.5 LTS to 5.3 and records nothing new: it reads the quiz events Moodle already logs.

This is the thirty-seventh plugin in our series: one plugin for each Moodle plugin type, each one teaching DevLMS Studio, our AI plugin builder, how that type works. Time per question has been asked for in Moodle’s tracker since 2015 (MDL-52248, 5 votes when we checked, still open). On Moodle Marketplace the closest quiz report, Random question summary, gives the average time for the whole attempt.

What it does

  • Median time per question, with a bar so the slow questions stand out, and the middle half of attempts once four or more have a time.
  • Every finished attempt with its time on each question, sortable (for example by total, to find rushed attempts) and downloadable in seconds.
  • Honest gaps. Attempts older than the log keeps show as no data, never zero. Time the report cannot place on a page is kept apart and counted, not guessed.
  • Follows the quiz’s groups, and only teachers, editing teachers and managers see it.

What it does not do

The time is how long a page was open, not attention. With several questions on one page, each shows the page’s time, and the report says so. A page left open more than 30 minutes counts as 30 (a setting). It needs the Standard log, which Moodle turns on by default. We have not tested attempts made in the Moodle app.

The code is on GitHub.

How a Moodle quiz report works

From Moodle 5.3’s quiz code (the same in 4.5):

  1. A quiz report is a small plugin under mod/quiz/report. The quiz lists every installed report its user may see in the Results menu and calls the report to draw its page.
  2. While a student takes a quiz, Moodle logs each page they open, each Next or Previous, each autosave and the summary page. The gap between opening a page and leaving it is the time on that page.
  3. Moodle writes the “page viewed” event with the previous page’s number (MDL-90028). We take each page from the save that ends the view instead, so the times stay right when Moodle fixes it.
  4. We test it with 34 unit tests on Moodle 4.5 and 5.3, one of them running Moodle’s own event code in the real page order, and a browser test where a student moves forward, back and through the summary before the teacher opens the report.

Need a plugin like this for your own Moodle?

Describe it in DevLMS Studio and watch it built and tested in a real Moodle, or ask our team for a fixed price.

Open DevLMS Studio