@glparker ,
In one of my classes, I use the average of all my quiz attempts. At the end of the semester, I go through and look for quizzes that were started (presumably on accident) but never attempted and ended with a score of 0 because time ran out. Because this is a problem to do by hand, I wrote a program to do it.
For each of the quizzes, I start off with with the quiz_submissions. If the attempt > 1, then I attempt to fetch all of the previous extra attempts by calling quiz_submissions with id and attempt set. I use a simple for loop with the index starting at 1 and going up to the number of attempts - 1 to get the additional ones.
I then iterate through all of the submissions, looking for end_at = finished_at. That will give you the people who had it autosubmitted because time ran out. Because I only want to exclude the false attempts, while still giving them a 0 if it's their only attempt, I also filter on score = 0 and attempt > 1.