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

Grade item inconsistencies can break courses with courses with activities that require grade

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE
    • MDL-71659-master-missinggradeitem
    • Hide

      The general workaround for both scenarios is to disable the "Require grade" completion condition in the activity by setting the "completiongradeitemnumber" field of the affected record to null.

      For duplicated grade items, the unused duplicated grade item(s) can also be deleted. Just make sure that the duplicate grade item that's being deleted is not being used anywhere (e.g. in "grade_grades", "grade_grades_history", etc.).

      Show
      The general workaround for both scenarios is to disable the "Require grade" completion condition in the activity by setting the " completiongradeitemnumber " field of the affected record to null. For duplicated grade items, the unused duplicated grade item(s) can also be deleted. Just make sure that the duplicate grade item that's being deleted is not being used anywhere (e.g. in " grade_grades ", " grade_grades_history ", etc.).
    • Hide

      N/A - covered by unit test

      Show
      N/A - covered by unit test

      If there are missing or duplicated grade items \completion_info::get_grade_completion() can throw errors when fetching grade completion data.

      To replicate:

      1. Create a course with activity completion with "Show completion conditions" enabled.
      2. Enrol a teacher and/or a student.
      3. Create an assignment a1. Make sure to "Require grade" as part of its activity completion conditions.
      4. Delete or duplicate a1's record from the grade_items table.
      5. View the course.
      Deleted grade

      An internal error occurred in the completion system. (System administrators can enable debugging information to see more detail.)
       
      More information about this error
       
      ×Debug info: Cannot find grade item for 'assign'
      cm '2' matching number '0'
      Error code: err_system
      ×Stack trace:
      line 1514 of /lib/completionlib.php: moodle_exception thrown
      line 774 of /lib/completionlib.php: call to completion_info->internal_systemerror()
      line 1136 of /lib/completionlib.php: call to completion_info->get_grade_completion()
      line 1111 of /lib/completionlib.php: call to completion_info->get_other_cm_completion_data()
      line 68 of /completion/classes/cm_completion_details.php: call to completion_info->get_data()
      line 273 of /completion/classes/cm_completion_details.php: call to core_completion\cm_completion_details->__construct()
      line 88 of /course/classes/output/cm_format.php: call to core_completion\cm_completion_details::get_instance()
      line 104 of /course/classes/output/section_format/cmitem.php: call to core_course\output\cm_format->export_for_template()
      line 119 of /course/classes/output/section_format/cmlist.php: call to core_course\output\section_format\cmitem->export_for_template()
      line 200 of /course/classes/output/section_format.php: call to core_course\output\section_format\cmlist->export_for_template()
      line 157 of /course/classes/output/course_format.php: call to core_course\output\section_format->export_for_template()
      line 84 of /course/classes/output/course_format.php: call to core_course\output\course_format->export_sections()
      line 102 of /course/format/renderer.php: call to core_course\output\course_format->export_for_template()
      line 60 of /course/format/topics/format.php: call to format_section_renderer_base->render()
      line 278 of /course/view.php: call to require()
      

      Duplicated grade

      Found more than one record in fetch() !
       
      More information about this error
       
      ×Debug info:
      Error code: morethanonerecordinfetch
      ×Stack trace:
      line 497 of /lib/setuplib.php: moodle_exception thrown
      line 163 of /lib/grade/grade_object.php: call to print_error()
      line 366 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
      line 758 of /lib/completionlib.php: call to grade_item::fetch()
      line 1136 of /lib/completionlib.php: call to completion_info->get_grade_completion()
      line 1111 of /lib/completionlib.php: call to completion_info->get_other_cm_completion_data()
      line 68 of /completion/classes/cm_completion_details.php: call to completion_info->get_data()
      line 273 of /completion/classes/cm_completion_details.php: call to core_completion\cm_completion_details->__construct()
      line 88 of /course/classes/output/cm_format.php: call to core_completion\cm_completion_details::get_instance()
      line 104 of /course/classes/output/section_format/cmitem.php: call to core_course\output\cm_format->export_for_template()
      line 119 of /course/classes/output/section_format/cmlist.php: call to core_course\output\section_format\cmitem->export_for_template()
      line 200 of /course/classes/output/section_format.php: call to core_course\output\section_format\cmlist->export_for_template()
      line 157 of /course/classes/output/course_format.php: call to core_course\output\section_format->export_for_template()
      line 84 of /course/classes/output/course_format.php: call to core_course\output\course_format->export_sections()
      line 102 of /course/format/renderer.php: call to core_course\output\course_format->export_for_template()
      line 60 of /course/format/topics/format.php: call to format_section_renderer_base->render()
      line 278 of /course/view.php: call to require()

      Note that this is a pre-existing issue that affects older versions of Moodle. It just so happens that we're encountering this early now in 3.11 since we're fetching the details about the activities' completion information upon course load.

      This problem with duplicated/deleted grade items can be encountered in 3.10 and below when the student visits an activity (e.g. an assignment) with deleted/duplicated grade item.

            mudrd8mz David Mudrák (@mudrd8mz)
            jpataleta Jun Pataleta
            Victor Déniz Falcón Victor Déniz Falcón
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            CiBoT CiBoT
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 35 minutes
                3h 35m

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