mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
185cfb095b
Previously we were literally doing hundreds of database queries, now it's very much faster. This makes the API slightly more complicated, but it's definitely worth it! Each module should implement modname_print_overview, which takes an array of courses and an array to fill up indexed by [$courseid]['modname'] for the controller to loop through and print. Each module should LIMIT the number of queries to use, all module instances can be fetched with the new function get_all_instances_in_courses which is the same as get_all_instances_in_course but takes an array of courses to fetch the instances for. This means there is no need to loop over the courses array and fetch the instances for each course (dramatically cutting down the number of queries!)