Hi all,
I just upgraded to Moodle 1.9 (from 1.8) this morning. However, when I went to view the grades in the grade report the first thing I noticed was that the workshop names were not carried over to the grade report. So, I clicked the synchronise from legacy button, now the names appear but the grades have still not been brought over.
--Phil
Workshop Grades Not Appearing in Grades Report in Moodle 1.9
Number of replies: 12Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
I'm having a similar problem.
Anyone know how to get workshop grades into the 1.9 gradebook? ...
is workshop officially unsupported core now? (ie - will vanish in time or continue to atrophy to a state of unusability?)
Lael
Anyone know how to get workshop grades into the 1.9 gradebook? ...
is workshop officially unsupported core now? (ie - will vanish in time or continue to atrophy to a state of unusability?)
Lael
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
I'm running into the same problem. Now at the end of the semester I notice that all of my workshop grades come up empty in 1.9.
Has anyone figured out a solution?
Has anyone figured out a solution?
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
Ok, so I figured out a fix. In the file moode/lib/gradelib.php, in the function named grade_update, down near the end of the function is the code:

Then, click the Synchronize legacy grades button:

if (empty($g['userid']) or ($k != $g['userid'])) { debugging('Incorrect grade array index, must be user id! Grade ignored.');
Add this code before the code above:
if (!empty($g['userid']) and ($k != $g['userid'])) { debugging('Reindexing!'); if (array_key_exists($g['userid'], $grades)) { debugging('Entry in $grades exists for uid ' . $g['userid']); } else { $grades[$g['userid']] = $g; } }Once you've done that, then go to the gradebook and select Categories and items from the drop-down menu:

Then, click the Synchronize legacy grades button:

Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
Fantastic. That fix worked just fine.
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
You should fill a bug report in the tracker (or find and existing one) and give the solution there 
Séverin
Séverin
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
In fact there already is a bug report for this issue.
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
will [it] vanish in time or continue to atrophy to a state of unusability?
Yes, unless someone volunteers to support it.
Yes, unless someone volunteers to support it.
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
I've written this code to be added to the workshop module so that the gradebook won't need to be synchronized in order to show its grades. The modification is for moodle 1.9.1 but I've reviewd the version changes file and it seems it haven't changed since 1.9.
I attach the lib.php to be overwritten (v 1.9.1). The modification is to be applied to mod/workshop/lib.php file.
2 new functions:
function workshop_grade_item_update($workshop, $grades=NULL){
global $CFG;
if (!function_exists('grade_update')) {
require_once($CFG->libdir.'/gradelib.php');
}
if (array_key_exists('coursemodule', $workshop)) {
$cmidnumber = get_field("course_modules", "idnumber", "id", $workshop->coursemodule);
$params = array('itemname'=>$workshop->name, 'needsupdate'=>1, 'idnumber'=>$cmidnumber);
} else {
$params = array('itemname'=>$workshop->name, 'needsupdate'=>1);
}
if ($workshop->visible == 0) {
$params['hidden'] = 1;
} else {
$releasetime = make_timestamp($workshop->releaseyear, $workshop->releasemonth, $workshop->releaseday, $workshop->releasehour, $workshop->releaseminute);
if($releasetime > time()){
$params['hidden'] = $releasetime;
}
}
if ($workshop->gradingstrategy == 0 OR ($workshop->grade == 0 AND $workshop->gradinggrade == 0)) {
$params['gradetype'] = GRADE_TYPE_NONE;
} else {
$params['gradetype'] = GRADE_TYPE_VALUE;
$params['grademax'] = $workshop->grade + $workshop->gradinggrade;
$params['grademin'] = 0;
}
if ($grades === 'reset') {
$params['reset'] = true;
$grades = NULL;
}
return grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 0, $grades, $params);
}
function workshop_grade_item_delete($workshop) {
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
return grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 0, NULL, array('deleted'=>1));
}
And a modification in add/update/delete module instance functions:
In function workshop_add_instance (+/- line 140) you find
add_event($event);
}
After that, and before the return it should be added:
$workshop = stripslashes_recursive($workshop);
$workshop->id = $returnid;
workshop_grade_item_update($workshop);
In function workshop_update_instance (+/- line 917) where you find
if (time() > $workshop->assessmentstart) {
// regrade all the submissions...
set_field("workshop_submissions", "nassessments", 0, "workshopid", $workshop->id);
workshop_grade_assessments($workshop);
}
This should be added before the return
$workshop = stripslashes_recursive($workshop);
workshop_grade_item_update($workshop);
In function workshop_delete_instance (+/- line 512) you find
if (! delete_records('event', 'modulename', 'workshop', 'instance', $workshop->id)) {
$result = false;
}
The following should be added:
workshop_grade_item_delete($workshop);
I attach the lib.php to be overwritten (v 1.9.1). The modification is to be applied to mod/workshop/lib.php file.
2 new functions:
function workshop_grade_item_update($workshop, $grades=NULL){
global $CFG;
if (!function_exists('grade_update')) {
require_once($CFG->libdir.'/gradelib.php');
}
if (array_key_exists('coursemodule', $workshop)) {
$cmidnumber = get_field("course_modules", "idnumber", "id", $workshop->coursemodule);
$params = array('itemname'=>$workshop->name, 'needsupdate'=>1, 'idnumber'=>$cmidnumber);
} else {
$params = array('itemname'=>$workshop->name, 'needsupdate'=>1);
}
if ($workshop->visible == 0) {
$params['hidden'] = 1;
} else {
$releasetime = make_timestamp($workshop->releaseyear, $workshop->releasemonth, $workshop->releaseday, $workshop->releasehour, $workshop->releaseminute);
if($releasetime > time()){
$params['hidden'] = $releasetime;
}
}
if ($workshop->gradingstrategy == 0 OR ($workshop->grade == 0 AND $workshop->gradinggrade == 0)) {
$params['gradetype'] = GRADE_TYPE_NONE;
} else {
$params['gradetype'] = GRADE_TYPE_VALUE;
$params['grademax'] = $workshop->grade + $workshop->gradinggrade;
$params['grademin'] = 0;
}
if ($grades === 'reset') {
$params['reset'] = true;
$grades = NULL;
}
return grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 0, $grades, $params);
}
function workshop_grade_item_delete($workshop) {
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
return grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 0, NULL, array('deleted'=>1));
}
And a modification in add/update/delete module instance functions:
In function workshop_add_instance (+/- line 140) you find
add_event($event);
}
After that, and before the return it should be added:
$workshop = stripslashes_recursive($workshop);
$workshop->id = $returnid;
workshop_grade_item_update($workshop);
In function workshop_update_instance (+/- line 917) where you find
if (time() > $workshop->assessmentstart) {
// regrade all the submissions...
set_field("workshop_submissions", "nassessments", 0, "workshopid", $workshop->id);
workshop_grade_assessments($workshop);
}
This should be added before the return
$workshop = stripslashes_recursive($workshop);
workshop_grade_item_update($workshop);
In function workshop_delete_instance (+/- line 512) you find
if (! delete_records('event', 'modulename', 'workshop', 'instance', $workshop->id)) {
$result = false;
}
The following should be added:
workshop_grade_item_delete($workshop);
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
We have Moodle 1.9.3+ and this fix doesn´t work
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
Same problem here [Moodle 1.9.3+ (Build: 20081029)], fixed by doing both
the post by Phil Ventura on Wednesday, 14 May 2008, 09:02 PM ( #p429094 )
and the post by David Monllaó - Tuesday, 1 July 2008, 08:09 PM ( #p443664 )
My many thanks to both Phil and David
the post by Phil Ventura on Wednesday, 14 May 2008, 09:02 PM ( #p429094 )
and the post by David Monllaó - Tuesday, 1 July 2008, 08:09 PM ( #p443664 )
My many thanks to both Phil and David
Re: Workshop Grades Not Appearing in Grades Report in Moodle 1.9
I have been patching in this fix for the last few upgrades but have just upgraded to 1.9.5+ (with the new gradebook) and have noticed a new problem and wondered if anyone else has experienced it.
Some of the workshops that have been used allow for resubmission, previously I could press the synchronise legacy button and it would update the value in the grade book but this does not seem to work with the new grade book.
Has any one else experienced any difficulties with resubmissions?