History | Log In     View a printable version of the current page.  
We are currently focused especially on Moodle 2.0, Moodle 1.9.x bugs and Moodle 1.9.x testing.    Confused? Lost? Please read this introduction to the Tracker.
Issue Details (XML | Word | Printable)

Key: MDL-15160
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Petr Škoda
Reporter: David Wong
Votes: 4
Watchers: 5
Operations

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: 03/Jul/08 06:55 AM
Component/s: Gradebook
Affects Version/s: 1.9.1
Fix Version/s: None

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

Participants: David Wong, Petr Škoda, Robert Puffer and Tom Trueluk
Security Level: None


 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 - 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 - 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 - 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 - 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 - 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 Škoda - 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 Škoda - 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