I've been developing a block module that needs to store some custom grades into gradebook. I've managed to store grade items, but couldn't manage to set grades for such items. My codes goes as follows:
$params = array(
'itemname' => $itemname,
'gradetype' => 2
);
$grade = new stdClass();
$obj = new stdClass();
$obj->userid = $userid;
$obj->rawgrade = 39;
$obj->feedback = 'Some text.';
grade_update('blocks/modulename', $courseid, 'block', 'modulename', $itemid, 0, $grade, $params);
Anyway, it keeps updating the grade_item, but no grade is added to the grade_grades table in the database. Am I missing any required parameter? Is this a bug? Thanks in advanced for your help.
Gradebook
How to add grade with grade_update() function?
This discussion has been locked so you can no longer reply to it.