Skip to content

Bug - grade category reset after import #204

Open
@ziegenberg

Description

@ziegenberg

There is a bug with the grade category after a course import

Steps to reproduce the bug

  1. Create a course c1
  2. Add a grade category cat1
  3. Add a Moodleoverflow activity modflow1
  4. Set the grade category of the Moodleoverflow activity modflow1 to cat1
  5. Inspect the database and note the value for gradecat in the table moodleoverflow for the Moodleoverflow activity modflow1 in course c1
  6. Inspect the database and note the value for categoryid in the table grade_items for the course c1
  7. These two values match.
  8. Create a course c2
  9. In course c2 import the Moodleoverflow activity modflow1 from c1
  10. Inspect the database and note the value for gradecat in the table moodleoverflow for the Moodleoverflow activity modflow1 in course c2
  11. Inspect the database and note the value for categoryid in the table grade_items for the course c2
  12. These two values do not match, but they should. The value in the column gradecat in the table moodleoverflow was not updated during the restore.

Bonuspoints

  1. Now enrol a user into course c2.
  2. Inspect the database and note the value for gradecat in the table moodleoverflow for the Moodleoverflow activity modflow1 in course c2
  3. Inspect the database and note the value for categoryid in the table grade_items for the course c2
  4. The value in the column gradecat in the table moodleoverflow was modified and for the course c2 we now use the grade category from course c1.

If you now open the grade report (grade/report/grader/index.php), you can see an exception:

Exception - Attempt to modify property "children" on null

It fails here: https://github.com/moodle/moodle/blob/139a0ad5f0458caaff7506c8b26081eea1c85231/lib/grade/grade_category.php#L2152

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions