Moodle
  1. Moodle
  2. MDL-29297

Grade Categories cause gradebook error after backup/restore

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.3, 2.0.4
    • Fix Version/s: None
    • Component/s: Backup, Gradebook
    • Labels:
      None
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      18841

      Description

      After restoring a course with grade categories, we're no longer able to access the gradebook with the message

      Found more than one record in fetch() !

      More information about this error

      Stack trace:
      line 429 of /lib/setuplib.php: moodle_exception thrown
      line 146 of /lib/grade/grade_object.php: call to print_error()
      line 316 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
      line 947 of /lib/grade/grade_item.php: call to grade_item::fetch()
      line 1004 of /lib/gradelib.php: call to grade_item::fetch_course_item()
      line 100 of /grade/report/grader/index.php: call to grade_regrade_final_grades()

      Upon further investigation we have found multiple copies in grade_items table with 'course' type for that course.
      Also in grade_categories table there are two toplevel categories listed for the course. (there was a singe subcategory in the original course).

      If we remove the duplicate rows in each table we get access to the gradebook but not the "Simple View" or "Full View" of the gradebook categories page.
      This is the error:
      Fatal error: Call to a member function is_aggregationcoef_used() on a non-object in /var/www/moodle/lib/grade/grade_item.php on line 1993

      Also accessing Quizzes seems to be affected as well:
      When trying to access Quiz:
      Found more than one record in fetch() !

      More information about this error

      Stack trace:
      line 429 of /lib/setuplib.php: moodle_exception thrown
      line 146 of /lib/grade/grade_object.php: call to print_error()
      line 316 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
      line 947 of /lib/grade/grade_item.php: call to grade_item::fetch()
      line 352 of /lib/gradelib.php: call to grade_item::fetch_course_item()
      line 686 of /mod/quiz/lib.php: call to grade_get_grades()
      line 1175 of /mod/quiz/lib.php: call to quiz_grade_item_update()
      line 121 of /mod/quiz/lib.php: call to quiz_after_add_or_update()
      line 410 of /course/modedit.php: call to quiz_add_instance()

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          Is this a duplicate of MDL-27395 ?

          Show
          Tim Hunt added a comment - Is this a duplicate of MDL-27395 ?
          Hide
          Trevor Jones added a comment -

          Yes this appears to be a duplicate.

          Show
          Trevor Jones added a comment - Yes this appears to be a duplicate.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Closing as duplicate of MDL-27395. Thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Closing as duplicate of MDL-27395 . Thanks!

            People

            • Votes:
              6 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: