Forum Ratings as Grades In Gradebook

Forum Ratings as Grades In Gradebook

by Keith C -
Number of replies: 3
I am trying to extract grade information from the grade_grades table.  It looks like a record gets written to grade_items for the forums but there is no instance of the grade in the grade_grades table. 

I understand the necessity of the gradebook being a denormalized presentation of data...but where do the forum grades come from?  Is the gradebook joined with some modules ????


In reply to Keith C

Re: Forum Ratings as Grades In Gradebook

by Keith C -

Just to give a picture of what I am trying to do:



SELECT u.firstname AS 'Name' , u.lastname AS 'Surname', c.fullname AS 'Course', cc.name AS
'Category',
CASE WHEN gi.itemtype = 'Course' THEN c.fullname + ' Course Total'
ELSE gi.itemname
END AS 'Item Name',
ROUND(gg.finalgrade,2) AS Score,
ROUND(gg.rawgrademax,2) AS MAX,
ROUND(gg.finalgrade / gg.rawgrademax * 100 ,0) AS Percentage,
IF (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) > 79,'Yes' , 'No') AS Pass,
gc.id
,CASE WHEN mass.duedate = 0 THEN 'Open Assignment'
ELSE FROM_UNIXTIME(mass.duedate, '%Y %D %M')
END AS DueDate
FROM mdl_course AS c JOIN mdl_context AS ctx ON c.id = ctx.instanceid
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id
JOIN mdl_user AS u ON u.id = ra.userid
JOIN mdl_grade_grades AS gg ON gg.userid = u.id
JOIN mdl_grade_items AS gi ON gi.id = gg.itemid
JOIN mdl_grade_categories AS gc ON gi.categoryid=gc.id
JOIN mdl_course_categories AS cc ON cc.id = c.category
LEFT OUTER JOIN mdl_assign AS mass ON gi.iteminstance=mass.id
WHERE  gi.courseid = c.id AND gi.itemname != 'Attendance' AND u.id=96 AND gc.parent=84
ORDER BY mass.duedate ASC;



I want to get all the student grades in a specified grade parent category.  Looks pretty good except I'm wracking my brain trying to deconstruct this to figure out where the forum grades are coming from!

In reply to Keith C

Re: Forum Ratings as Grades In Gradebook

by Keith C -

Also,

I have reviewed the ERD which does not indicate any external relationships...

In reply to Keith C

Re: Forum Ratings as Grades In Gradebook

by Itamar Tzadok -

The forum grade is an aggregation of ratings. The ratings are stored in the mdl_rating table and identified by component = mod_forum, ratingarea = post and itemid = <post id>. hth smile