queries for moodle reports