I'm a novice moodle and php user, I hope this is the right place to ask this question.
A company I am volunteering with, decided to want some statistics for a moodle quiz they created.
We decided on time spent per question, time spent on different categories in the quiz and total score per category.
The form submission send the question data to mod_quiz/processattempt.php , so in the, near the end I added my line for the db insert.
It worked well, we got data being inserted into our table, but a week after going live, we got complaints that sometimes categories didn't match up for the individual questions.
Doing some testing, I came to notice that occasionally, there was a skip on the step to insert data into our table.
I know PHP is a Synchronous language, although I'm very new to it. This shouldn't be happening, I thought that perhaps there was a bottleneck effect from the server being busy, because I did have a query a few lines earlier.
So I added a delay
Did it in between my query and the insert, added a delay between my code and the moodle code in processattempt.php, added a delay after.
But nothing I did caused the missing inserts from going away. It always happened randomly. Sometimes after completing 13 questions, sometimes it would happen after 40 questions. It would even occur twice in a row.
I still think it might be a server issue because in the server for development it happens more frequently. For what I have been told, in the server with the live version, it usually happens around question 120 to 160.
I am wondering if other people had had similar issues?