|
Looking further at this, while I recommend the above change (as it will allow courses to be restored with some additional hand tweaking), the aggregation method for the course is not in the backup XML, so there is no way to restore it. Apparently it uses the default aggregation method for the new course, which will not be correct in the case of weighted courses.
Changing this to critical to try to give this more attention. Without at least setting the categoryid to null, fixing the gradebook for a course will require going into the database by hand.
Gary Anderson made changes - 04/Mar/08 04:02 PM
Thanks, Gary. Passing to Petr for 1.9.1
Martin Dougiamas made changes - 04/Mar/08 04:13 PM
Petr Skoda made changes - 09/Mar/08 09:52 AM
working on gradebook restore rewrite just now...
should be fixed now, thanks for the report
Petr Skoda made changes - 18/Mar/08 04:57 AM
Although the original zip file restores without the categories, it does import OK without creating phantom entries.
I needed to reset the course aggregation method to weighted mean of grades, and assigned weights to each category, and the computations were correct, as was all the formatting. I then exported and did a restore and the computations on the new course worked correctly. So, in summary, while backing up from the original release of 1.9 does not fully restore categories, it does import in a way that can be fixed. And, backing up and restoring from the most recent update works correctly for backup and restore for 1.9, at least with respect to the sample gradebook tutorial that I made on docs.moodle.org for weighted grades.
Gary Anderson made changes - 30/Mar/08 12:15 AM
As a demonstration of a working backup for anyone wanting to test a weighted gradebook further, attached is a backup of the course used in http://docs.moodle.org/en/Gradebook_1.9_Tutorial
Gary Anderson made changes - 30/Mar/08 12:21 AM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$dbrec->courseid = $restore->course_id;
if (isset($SESSION->restore->importing)) {
to
$dbrec->courseid = $restore->course_id;
$dbrec->categoryid =null;
if (isset($SESSION->restore->importing)) {
is the easiest partial fix.
The problem is that grade categories have categoryid set to null, but a conditional does not consider this.
In reality, there should be an unset called after the insert_record later in the code, but the $dbrec is used after that in the code, so the fix will be more complicated.
Also, this fix does not resolve all proglems. The aggregation method for the course is not set even after this fix, but that can not be corrected until something is done about this problem.