Identifying "Category Total" grades in db

Identifying "Category Total" grades in db

by Jerome Plumat -
Number of replies: 1

Dear all,

I recently started development in the Moodle world ! This is my first post in the forum so please let me know I miss something.

I recently started a development for a simple plugin that aggregates grades and feedbacks by category.
Consequently, I would like to access some particular grades in the database.

My scenario is the following : I have a course with a student, I have some grades split into 2 categories. In my grade book, I have auto-generate “Category Total” grades representing the weighted sum of the grades belonging to a particular category.

I would like to identify these “Category Total” grades in my `grade_grades` table for particular categories.

I have seen that each of these grades is linked with a `grade_items` that has its `itemtype` equal to the string `category`. However, the items I have found have their categoryid empty. And so, I don’t know how to identify any of these totals.

My questions are :

  • Is that standardised to use the item.itemtype = ‘category’ to identify the different “category totals” ?
  • Why the items linked to the “category total” grades do not belong to the same category as the items they sum ? 
  • Is there a way to parametrised Moodle to do so ?
  • If not, how can I identify the grades (and their feedbacks) corresponding to the “category total” for a particular category ?

Thanks a lot in advance,
Jérome