Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-69418

Allow plugins to attach data to grade items during backup and restore

    XMLWordPrintable

Details

    • MOODLE_39_STABLE
    • MOODLE_310_STABLE
    • MDL-69418-master
    • Hide
      1. Install a helper plugin https://github.com/dmitriim/moodle-local_helper to local/helper
      2. Create a course.
      3. Create a manual grade item: within the course  navigate to Grades > Setup
      4. Enable debugging on: Site administration -> Development -> Debugging. 
      5. Tail the web server's error log:

        tail -f /var/log/apache2/error*log
        

        Note: It may be located somewhere else.

      6. Back up the course using default settings
        1. Confirm sure that you can see "Yay, attaching data to grade item!" in your error log file
      7. Restore the course using default settings
        1. Confirm that you can see "Yay, restoring data for grade item: 1 - Test helper" in your error log file.
      8. Download the file and rename it to 69418.tgz
      9. Unzip it:

        tar -zxf 69418.tgz
        

      10. Open the expanded gradebook.xml
        1. Confirm that the test category you created is present
      11. Navigate to the Gradebook in the newly created course
        1. Confirm that the Manual Grade item was also restored
      Show
      Install a helper plugin  https://github.com/dmitriim/moodle-local_helper  to local/helper Create a course. Create a manual grade item: within the course  navigate to Grades > Setup Enable debugging on: Site administration -> Development -> Debugging.  Tail the web server's error log: tail -f /var/log/apache2/error*log Note: It may be located somewhere else. Back up the course using default settings Confirm sure that you can see "Yay, attaching data to grade item!" in your error log file Restore the course using default settings Confirm that you can see "Yay, restoring data for grade item: 1 - Test helper" in your error log file . Download the file and rename it to 69418.tgz Unzip it: tar -zxf 69418.tgz Open the expanded gradebook.xml Confirm that the test category you created is present Navigate to the Gradebook in the newly created course Confirm that the Manual Grade item was also restored

    Description

      Currently it's not possible to to attach anything to grade items from local plugins (actually from any other plugin types) during backup/restore.

      In my case I have  a local plugin which adds custom fields to manual grade items in a custom form (using custom fields API). For the fields data I use course context and grade item id as an instance id.  I can't backup and then restore this data as I can't attach anything to grade items. (Actually I can back it up and put to course.xml, but not able to restore as restore_gradebook_structure_step gets processed during restore_final_task which runs after course restore task, so I don't know new grade items ids at the time when processing of course.xml happens).

      Would be good if we can extend backup_gradebook_structure_step and restore_gradebook_structure_stepto allow local plugins to hook into grade items via add_plugin_structure?

      Attachments

        Issue Links

          Activity

            People

              dmitriim Dmitrii Metelkin
              dmitriim Dmitrii Metelkin
              Tom Dickman Tom Dickman
              Andrew Lyons Andrew Lyons
              Janelle Barcega Janelle Barcega
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Nov/20

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 28 minutes
                  1h 28m