Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - grade category reset after import #204

Open
ziegenberg opened this issue Feb 7, 2025 · 0 comments
Open

Bug - grade category reset after import #204

ziegenberg opened this issue Feb 7, 2025 · 0 comments
Labels

Comments

@ziegenberg
Copy link
Contributor

ziegenberg commented Feb 7, 2025

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

@dlmsr dlmsr added the bug label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants