Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-117

Added gradebook events erroneously get deleted from grade_item table.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.2
    • None
    • Patch: Gradebook Plus
    • None
    • MOODLE_18_STABLE

    Description

      In some cases, added gradebook events that are assigned to a category will get moved back into the uncategorized category as soon as the teacher clicks on the view or edit tabs. Any grades previously given to those events will be lost.

      Looking at the grade_item table, it appears that the gradebook events are being deleted from the table. If you then go to the add event or category tabs, the added items are re-inserted.

      The problem is in lib.php, in grade_get_grades(). If there is an item that was deleted, it is supposed to be removed from the grade_item table, but it is incorrectly removing items matching $mods->modid instead of $mod->modid. The result is that anything with a modid of 0 (added events) gets deleted, and the deleted assignment/quiz/whatever doesn't ever get deleted.

      Index: lib.php
      ===================================================================
      RCS file: /cvsroot/moodle/contrib/patches/gradebookplus_v2_1.7/lib.php,v
      retrieving revision 1.3.2.10
      diff -c -r1.3.2.10 lib.php

          • lib.php 5 Oct 2007 03:41:06 -0000 1.3.2.10
          • lib.php 18 Oct 2007 19:39:03 -0000
            ***************
          • 806,812 ****
            else
            Unknown macro: { // delete this item from the grade_item table since it was deleted through the mod interface (unless it is a graded_event) if (!empty($mod->modid) && $mod->modname != 'grade') { ! delete_records('grade_item', 'modid', $mods->modid, 'courseid', $course->id); delete_records('grade_exceptions', 'grade_itemid', $mod->id, 'courseid', $course->id); } }
          • 807,813 ----
            else
            Unknown macro: { // delete this item from the grade_item table since it was deleted through the mod interface (unless it is a graded_event) if (!empty($mod->modid) && $mod->modname != 'grade') { ! delete_records('grade_item', 'modid', $mod->modid, 'courseid', $course->id); delete_records('grade_exceptions', 'grade_itemid', $mod->id, 'courseid', $course->id); } }

      Attachments

        Activity

          People

            aborrow Anthony Borrow
            adamann2 Ann Adamcik
            Wen Hao Chuang Wen Hao Chuang
            Anthony Borrow
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: