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

"Found more than one record in fetch() !" exception when editing settings on an upgraded assignment

XMLWordPrintable

    • MOODLE_23_STABLE
    • MOODLE_23_STABLE
    • Hide
      1. On a clean moodle installation create 1 instance of the old assignment module and 1 instance of the new assignment module. (Must be clean so the database ids will collide)
      2. Use the assignment upgrade tool to upgrade the old assignment
      3. Edit the settings for the upgraded assignment and click save
      4. Verify that the settings are saved and you do not receive an error: "Found more than one record in fetch() !"
      Show
      On a clean moodle installation create 1 instance of the old assignment module and 1 instance of the new assignment module. (Must be clean so the database ids will collide) Use the assignment upgrade tool to upgrade the old assignment Edit the settings for the upgraded assignment and click save Verify that the settings are saved and you do not receive an error: "Found more than one record in fetch() !"

      When an assignment has been upgraded from 2.2 to 2.3, in certain circumstances it can become broken. Whenever the user submits a change to any setting; Moodle throws an exception. The exception is:

      Found more than one record in fetch() !

      More information about this error
      Debug info:
      Error code: morethanonerecordinfetch
      Stack trace:

      line 467 of /lib/setuplib.php: moodle_exception thrown
      line 163 of /lib/grade/grade_object.php: call to print_error()
      line 326 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
      line 291 of /course/moodleform_mod.php: call to grade_item::fetch()
      line 120 of /mod/assign/mod_form.php: call to moodleform_mod->validation()
      line 523 of /lib/formslib.php: call to mod_assign_mod_form->validation()
      line 472 of /lib/formslib.php: call to moodleform->validate_defined_fields()
      line 569 of /lib/formslib.php: call to moodleform->is_validated()
      line 269 of /course/modedit.php: call to moodleform->get_data()

      This is very difficult to recreate as it is more of a problem on the qa.moodle.net and Mount Orange School demo site.

      To recreate:
      Method 1:
      Test Pre-requisites:

      • Use the attached backup file of the Moodle Features demo course.

      Test steps:

      1. Restore the course and access any of the assignments under the Label OLD 2.2 Assignments. These are 2.2 assignments converted to 2.3 on the MoodleQA site.
      2. Navigate to Assignment settings and change any setting (I used grading method, setting it to marking guide).
      3. Click Save and display.

      Expected result:

      • Moodle displays the correct page (in my case marking guide).

      Actual result:

      • Moodle displays the aforementioned exception and the changes are not saved.

      Method 2 - this only works on my local Moodle with Advanced uploading of files:
      Test steps:

      1. Create an Advanced uploading of files 2.2 assignment subtype in any course.
      2. Upgrade the assignment to 2.3.
      3. Navigate to Assignment settings and change any setting (I used grading method, setting it to marking guide).
      4. Click Save and display.

      Expected result:

      • Moodle displays the correct page (in my case marking guide).

      Actual result:

      • Moodle displays the aforementioned exception and the changes are not saved.2

        1. backup.mbz
          383 kB
          Tim Barker
        2. backup-with_2.2_assignments.mbz
          1.20 MB
          Tim Barker
        3. mdl_grade_items.csv
          4 kB
          Tim Barker

            damyon Damyon Wiese
            timb Tim Barker
            Dan Poltawski Dan Poltawski
            Jason Fowler Jason Fowler
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.