Skip to content
New issue

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

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

Already on GitHub? # to your account

Add support for Course Reset #64

Open
luisdev opened this issue Feb 27, 2023 · 5 comments
Open

Add support for Course Reset #64

luisdev opened this issue Feb 27, 2023 · 5 comments

Comments

@luisdev
Copy link

luisdev commented Feb 27, 2023

  1. Install the Subcourses module in your Moodle site.
  2. Open a course in Moodle.
  3. Open the Course Administration block in that course.
  4. Click Reset.
  5. Moodle shows the Reset Course page (/course/reset.php?id=123) with all the options for resetting the course.
  6. Scroll down to the "Reset not implemented" section. If necessary, click the Show More option to expand the section.

You'll see that the Subcourses plugin is listed as one of the activities where Course Reset has not implemented. I presume that Subcourses activity data will not be cleared when the course is reset. This could result in "Subcourses garbage" remaining behind when a course is reset.

Please can support for Course Reset be added to the Subcourses plugin so that all Subcourses data is cleared when a course containing a Subcourses activity is cleared.

I've only observed the above behaviour in Moodle 3.9. Not tested in newer versions of Moodle (my Moodle 4 test server is down...)

@mudrd8mz
Copy link
Contributor

so that all Subcourses data is cleared

Well. But what would be those data? The Subcourse instance does not really store anything. It just acts as a proxy to push the final grade as the activity grade to the gradebook. Do you mean it should reset the grades? Is not it the case automatically?

@luisdev
Copy link
Author

luisdev commented Mar 8, 2023

The data that got my attention is the subcourse data that seems to have been "left behind" in the subcourse table after the subcourse activities were deleted from a course.

This query:
SELECT id, course, name, refcourse FROM mdl_subcourse WHERE course = 11580
returns 3 records in my Moodle database.

id	course	name		refcourse
862	11580	MySubcourseX	11458
863	11580	MySubcourseY	11312
864	11580	MySubcourseZ	11546

But the above subcourse activities (862,863,864) have all been deleted from course 11580. So, should those records for those deleted activities still be in the mdl_subcourse table or should they have been deleted when the subcourse activities were deleted from the 11580 course?

Course 11580 is a completely blank course - there are no activities in that course and no enrolled users.

@luisdev
Copy link
Author

luisdev commented Mar 8, 2023

According to my Moodle Cron Logs, it seems like the subcourse module is still trying to fetch grades into the 11580 course for the three subcourse activities that have been deleted in course 11580:

Subcourse 857: fetching grades from course 531 to course 11583 ... ok
Subcourse 858: fetching grades from course 450 to course 11583 ... ok
Subcourse 859: fetching grades from course 86 to course 11583 ... ok
Subcourse 860: fetching grades from course 11567 to course 11585 ... ok
Subcourse 862: fetching grades from course 11458 to course 11580 ... failed with error code 4
Subcourse 863: fetching grades from course 11312 to course 11580 ... failed with error code 4
Subcourse 864: fetching grades from course 11546 to course 11580 ... failed with error code 4

Subcourse 875: fetching grades from course 11479 to course 11589 ... ok
Subcourse 876: fetching grades from course 11220 to course 11279 ... ok
Subcourse 877: fetching grades from course 11071 to course 11589 ... ok

My course 11580 is a completely blank course at the moment - all activities in that course were deleted.

@mudrd8mz
Copy link
Contributor

But the above subcourse activities (862,863,864) have all been deleted from course 11580

In that case, those records in the mdl_subcourse would be deleted, too. The function subcourse_delete_instance() does it as is standard in Moodle. How did you delete the Subcourses? Are they gone from the mdl_course_modules too?

@danmarsden
Copy link
Member

Hi Luis - are you still having an issue here? - would be good to know if you deleted those courses strangely or if there's a delete course modules task in a failing state on your site preventing the subcourse from being deleted correctly.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants