Issue Details (XML | Word | Printable)

Key: MDL-15160
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Petr Skoda
Reporter: David Wong
Votes: 7
Watchers: 7
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Importing an existing course in 1.9.1 to a new course in 1.9.1 on same server results in categories and formulas being lost in gradebook

Created: 05/Jun/08 10:24 PM   Updated: 01/May/09 03:16 AM
Return to search
Component/s: Gradebook
Affects Version/s: 1.9.1
Fix Version/s: 2.0

Environment:
Mac OSX server
php 5.2
mysql 5.0.24a
Issue Links:
Relates
 

Participants: David Wong, Emma Richardson, Mary Parke, Petr Skoda, Robert Puffer and Tom Trueluk
Security Level: None
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
We are using a test dev server for teachers to construct their online courses. We intend to back them up and move to a prod server using same version of Moodle, etc. In testing the restore function to a NEW course, when you restore a course the gradebook's categories and formulas are missing in the new course though teachers had set them up in the course. I listed this as a major bug because teachers would have to reset up their gradebooks for every course shell.

Steps to reproduce:

1. create a course backup without student data.
2. restore this backup to new course
3. check new course gradebook for categories and formulas that were in old course. they are missing.

Note, the grade book categories ONLY restore if you restore the course to a new course WITH user data.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Robert Puffer added a comment - 01/Jul/08 12:04 AM
I believe this is actually fixed in the latest 1.91+ but isn't fixed in the importing feature – A MAJOR DISABILITY!!

David Wong added a comment - 01/Jul/08 02:01 AM
Robert,

We're using build Moodle 1.9.1+ (Build 20080521) so unless it was released after this then I don't think so. I've been watching the release notes and didn't see a fix in the notes but I could have missed it.


Robert Puffer added a comment - 01/Jul/08 02:27 AM
When I was using that build it wasn't fixed either. We're now on 20080618 and the backup and restore is fixed but the import is not.

David Wong added a comment - 01/Jul/08 04:09 AM - edited
Robert,

Thanks. Let's hope that they elevate this problem to a priority so that gets fixed sooner than later. Did you file a separate bug in terms of the import content function or were you hoping that they'd read this one and act on it?


Tom Trueluk added a comment - 03/Jul/08 02:32 AM
Not sure why grade_categories aren't backed up when user_data is not selected. But here are the two locations in backup/backuplib.php where it needs to be fixed.

First in function backup_gradebook_info it sets $backupall to false, as shown:

// if no user data selected, we do not backup categories
if (!backup_userdata_selected($preferences,$grade_item->itemmodule,$grade_item->iteminstance)) {
$backupall = false;

Meaning, when we get here (shortly below the above code)

// Now backup grade_item (inside grade_category)
if ($backupall) { $status = backup_gradebook_category_info($bf,$preferences); }

Gradebook categories aren't backed up.

And also in the function backup_gradebook_item_info, if the grade_item is of type category it isn't backed-up if $backupall is false:

} else if ($grade_item->itemtype == 'category') {
// if not all grade items are being backed up
// we ignore this type of grade_item and grades associated

if (!$backupall) { continue; }
}

I'm not sure why it's programmed this way, but removing the $backupall conditional statements in backuplib.php will fix the issue of missing categories.

But, manual grade_items which have a calculation are not restored correctly. The new grade_item ID's aren't populated in the calculation when restored and instead the calculation string from the backup file is plugged straight into the database. The id's in the calculation string need to be adjusted to reflect the newly created ID's for the restored grade_items.


Petr Skoda added a comment - 03/Jul/08 06:53 AM
thanks Tom for the info, I have files a new bug for this backup issue . it should be fixed now; categories are not included if some mods are not selected instead of when user data not selected

Petr Skoda added a comment - 03/Jul/08 06:55 AM
the gradebook categories are not restored intentionally, the problem is that you do not always want the gradebook categories when importing

solution could be to add some new switch that would force gradebook category import
as a workaround please use full backup/restore for now


Mary Parke added a comment - 10/Dec/08 08:39 AM
I think the disconnect here is that many schools do not use an "Import" process for course management from semester to semester. Instead, they use the restore process - whereby "import" is not the point. Instead, a "carbon copy" of a course (the backup) is restored from semester to semester w/o user data so that 1) the school has a separate unique record of a course previously taught that can be archived for records or 2) the school has a separate unique course for that semester that a student can re-enter to makeup an "incomplete" within the allotted timeframe.

I think this is a big disconnect on how Moodle is implemented in US higher education public institutions - not everyone will use this same process, but those of us I know of (community college level, state university level, etc.) use a process similar to that as described above.

I have documentation on this process as well as a video if anyone is interested in a use-case-scenario. Email me at mparke at ccsf dot edu.

Thanks to everyone here for contributing to a fix.


Emma Richardson added a comment - 27/Jan/09 03:53 AM
I cannot get this to work - I presume that I am deleting the wrong part. I have tried deleting out both bottom statements which breaks the backup process altogether. I then tried deleting out the "if($backupall)" reference from each part. This kept the backup working but I still was unable to import the category. Should I delete the first statement? This does not make sense to me. Help please - can you let me know exactly what I need to take out to get this to work.
Thanks in advance!