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

    Details

    • Testing Instructions:
      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() !"
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      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

        Attachments

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

          Issue Links

            Activity

              People

              Assignee:
              damyon Damyon Wiese
              Reporter:
              timb Tim Barker
              Integrator:
              Dan Poltawski
              Tester:
              Jason Fowler
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Jun/12