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

Students not being automatically enrolled #37

Open
2 tasks done
Vidsify opened this issue Aug 19, 2024 · 5 comments
Open
2 tasks done

Students not being automatically enrolled #37

Vidsify opened this issue Aug 19, 2024 · 5 comments
Assignees

Comments

@Vidsify
Copy link

Vidsify commented Aug 19, 2024

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Describe the bug

We have multiple courses set up that require the completion of a pre-requisite course. However, when students successfully complete the courses, they are not automatically enrolled in the next course. Therefore, we have to do it manually.

We have set up a CRON to force the update every 15 minutes; however, this hasn't worked. Script used is
moodle.DOMAIN/admin/cli/scheduled_task.php --execute='\core\task\completion_regular_task' though is does run successfully.

Execute scheduled task: Calculate regular completion data (core\task\completion_regular_task)
... started 18:40:38. Current memory use 15.4 MB.
Running completion_criteria_date->cron()
Running completion_criteria_activity->cron()
Running completion_criteria_duration->cron()
Running completion_criteria_grade->cron()
Running completion_criteria_course->cron()
Aggregating completions
... used 6 dbqueries
... used 0.083964109420776 seconds
Scheduled task complete```

image

image

To Reproduce

See screenshots above

Expected behavior

We expect students to be enrolled automatically. With the amount of students we have its becoming very difficult to manually enrol students.

Additional context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible, except under certain conditions.

  • Moodle version: 4.4.2+ Build: 20240816
  • plugin version v4.4.3 2024070200
  • PHP Version: 8.2.22
@ewallah
Copy link
Owner

ewallah commented Aug 20, 2024

THX for the report. I see that 167 students are already enrolled using this plugin, so this plugin worked fine in the past?

First let me say that no extra cron is needed, the standard Moodle cron jobs normally work fine.

Next I need to be sure the course completion event is happening. This can be seen

  • in the course completion report (report/completion/index.php?course=yyyy) where the last column shows a check marking the course as complete
    ewallah_001_19082024_200330
  • in the course logs ( "The user with id 'xxxx' completed the course with id 'yyyy'.")

When this event is not happening, the enrollment is also not happening. The reason why the course completion is not working as expected are almost always an impossible course completion setting: a module required to complete the course was

  • deleted: check the course completion settings (course/completion.php?id=yyyy) and make sure all required modules are existing
  • hidden: check the course completion settings (course/completion.php?id=yyyy) and make sure all required modules are visible/available

You can check this by enrolling a test user in your course and as a teacher (yes, admins cannot do this, you have to enroll yourself as a teacher), manually mark all course completion requirements for this test user in the course completion report (course/completion.php?id=yyyy). Wait 2 minutes and refresh the course completion report, the last column should mark this test user as complete and this test user should be enrolled in the course. Check the logs and you should see 3 entries:

  1. The user with id 'xxxx' completed the course with id 'yyyy'.
  2. The user with id 'xxxx' enrolled the user with id 'xxxx' using the enrolment method 'coursecompleted' in the course with id 'zzzz'.
  3. The user with id 'xxxx' assigned the role with id '5' to the user with id 'xxxx'.

So please provide:

  1. a screenshot of the course completion report showing the test user did complete the course
  2. a screenshot of the logs showing The user with id 'xxxx' completed the course with id 'yyyy'.
  3. a screenshot of the course participants where the test user is NOT enrolled.

@Vidsify
Copy link
Author

Vidsify commented Aug 20, 2024

Hi @ewallah, Thanks for the quick response. Yes, the plugin worked in the past; however, I am unsure when it stopped working.

I can confirm that the Course Completion works correctly when a student passes the relevant exam, which is displayed in the Course Report.

Logs are also indicating Course Completion working correctly.
image

I have added a test user and marked everything as completed

image

Live Logs of Course A: Doesn't appear to be updating. Waited around 10 minutes.
image
image

Course B: Show no enrolment from the plugin

@ewallah
Copy link
Owner

ewallah commented Aug 22, 2024

THX for your quick response.

I will try to create a behat script mimicking your situation: self enrollment with some users disabled in combination with manual enrollment.

Are you using other plugins (recompletion - progress bar - ...) that interact with course completion?

I see 2 possible scenarios for your problem: The callback is never reached or the enroll breaks for some reason or other.

Can you check that the test user is appearing in the enrol users who completed the course in the past? Users > Enrolment methods > After completing course xxx > enrol users ?

@Vidsify
Copy link
Author

Vidsify commented Aug 25, 2024

The only other plugin we are using is https://moodle.org/plugins/enrol_attributes but this doesn't interact with course completion.

I cannot find the enrolled users who completed the course in the past

@ewallah
Copy link
Owner

ewallah commented Aug 26, 2024

Do you have ad hoc tasks ? Site administration / Server / Tasks / Ad hoc tasks
When the enrollment is in the future, the enrollment happens with an ad hoc task.

P.S. On first sight, the combination with the enrol_attributes works fine: https://github.com/ewallah/moodle-enrol_coursecompleted/actions/runs/10551462448/job/29228939200#step:4:1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants