counting number of students who haven't submitted anything?

counting number of students who haven't submitted anything?

by Brian Jorgensen -
Number of replies: 0
Hi, All:


I have been asked to count the number of students in a course who haven't submitted anything in all instances of five different activity types for the last seven days.

My current solution involves iterating through all the course sections, finding the mods, iterating through the mods that are of the correct type, and calling *_get_recent_mod_activity for each user for each mod (yes, another nested iteration).

I have done a bunch of optimizations, like not doing further lookups for users that have submitted something in an earlier mod, and stopping all lookups once it is known that all users have submitted something.

However, this approach is still very slow (5-10 seconds) for a course with lots of activities, lots of students, and no submissions. In other words, the beginning of the school year.

I suspect the problem is mostly the inefficiency of calling *_get_recent_mod_activity for each individual user for each mod; in other Moodle work, I've seen speed benefits from passing in all users to minimize the number of database lookups.

I'm a little loathe to create new versions of these functions for core mods that take arrays of users; or would this be seen to be useful for the community codebase? Or does anyone have any suggestions for alternative approaches? I appreciate any advice.


Thanks,

Brian
Average of ratings: -