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

Fatal error trying to restore a course containing an assignment using a rubric

    Details

    • Testing Instructions:
      Hide
      1. Restore the backup attached to this issue in a new course selecting all the activities
      2. It SHOULD NOT crash
      3. Create / goto a course with student/s
      4. Add an assignment (the old or the new one) with rubrics as a grading method
      5. Create a rubric with 3 criteria
      6. Grade a user using the rubric
      7. Edit the rubric and delete 2 of the 3 criteria, you will receive a warning, but click the continue button
      8. Backup the course
      9. Extract the backup into a folder and open the activities/assignment_??/grading.xml file of the graded activity, there SHOULD NOT be a filling tag pointing to a non defined criterion
      10. Restore the course, it SHOULD NOT crash
      Show
      Restore the backup attached to this issue in a new course selecting all the activities It SHOULD NOT crash Create / goto a course with student/s Add an assignment (the old or the new one) with rubrics as a grading method Create a rubric with 3 criteria Grade a user using the rubric Edit the rubric and delete 2 of the 3 criteria, you will receive a warning, but click the continue button Backup the course Extract the backup into a folder and open the activities/assignment_??/grading.xml file of the graded activity, there SHOULD NOT be a filling tag pointing to a non defined criterion Restore the course, it SHOULD NOT crash
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-32499_master

      Description

      As part of my review for MDL-31270 I have been working on creating a test suite of assignments that I can upgrade.
      As part of that test suite I have a course that contains several assignments, a couple of which are using advanced grading, some using rubrics, and some using the marking guide plugin (MDL-31731) that will be arriving in master in the next couple of weeks in time for 2.3.
      I've just tried restoring a backup of the course that I have just taken and found that I get the following fatal error.

      Debug info: ERROR: duplicate key value violates unique constraint "mdl_gradrubrfill_inscri_uix"
      DETAIL: Key (instanceid, criterionid)=(34, 0) already exists.
      INSERT INTO mdl_gradingform_rubric_fillings (criterionid,levelid,remark,remarkformat,instanceid) VALUES($1,$2,$3,$4,$5) RETURNING id
      [array (
      'criterionid' => 0,
      'levelid' => 0,
      'remark' => 'Good',
      'remarkformat' => '0',
      'instanceid' => 34,
      )]
      Stack trace:

      line 413 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 237 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 795 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 847 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
      line 112 of /grade/grading/form/rubric/backup/moodle2/restore_gradingform_rubric_plugin.class.php: call to pgsql_native_moodle_database->insert_record()
      line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_gradingform_rubric_plugin->process_gradinform_rubric_filling()
      line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      line 125 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
      line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
      line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
      line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
      line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      line ? of unknownfile: call to progressive_parser->end_tag()
      line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 187 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
      line 148 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
      line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 310 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
      line 46 of /backup/restore.php: call to restore_ui->execute()

      Of course to be sure I can reproduce it I have tried to restore the course a couple of times and in a couple of different ways but always the same outcome.
      I'll attach my course backup after I create this issue so that you can test it out as well, please note though you will need to install the marking guide plugin (MDL-31731) in order to test this.
      The restore may work without it, it may not, I don't know but either way its not the issue at hand

      Cheers
      Sam

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/12