i'm writing an api to check if the students enrolled in a specific course has completed the course.
I'm using core_course_get_enrolled_users_by_cmid to get the users list and then i parse it to obtain the IDs.
After that i run core_completion_get_course_completion_status to test every IDs and see who completed it and who hasn't.
The goal i have in mind is cycling this through all courses i need to check monthly and the the e-mails of those who has or has not completed the course.
Now i'm having thought about performance. Every course has 10.000 users at least and the core_completion_get_course_completion_status works for single users so i'm looking at 10.000 calls for every calls.
Is there a smarter way of doing this? How?