I am asked to display a table of the Gradebook categories and modules with all the aggregation information (like: weights, factor, ... ) on some external SIS app that is connected with our Moodle. So I am aiming for a single SQL query that will help me display all the information in one go. (by using a course id)
I researched the code that displays the Gradebook page (https://github.com/moodle/moodle/blob/master/grade/edit/tree/lib.php) and read the Moodle developer wiki (https://docs.moodle.org/dev/Grades) and also tried to find some clues on the ad-hock sql queries wiki page (https://docs.moodle.org/29/en/ad-hoc_contributed_reports) and (of course) the Moodle DB schema (https://docs.moodle.org/dev/Database_Schema#Moodle_2.9) but could not find a definite documentation that could lead for the logics needed to form a single SQL query that displays the Gradebook .
It seems, the combination of mdl_grade_grades and mdl_grade_items are holding all the Gradebook aggregation info, but also the student's actual grade item values. Is that true?
Does creating a single SQL query that displays the Gradebook is at all possible? (or do I need some php for that?)