Fix auto-distribution to check student role via ad-hoc task#72
Draft
Copilot wants to merge 13 commits intoexperimentalfrom
Draft
Fix auto-distribution to check student role via ad-hoc task#72Copilot wants to merge 13 commits intoexperimentalfrom
Copilot wants to merge 13 commits intoexperimentalfrom
Conversation
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix navigation and page format for category_distribution.php
Implement backup/restore and fix navigation for category distribution
Feb 25, 2026
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Copilot
AI
changed the title
Implement backup/restore and fix navigation for category distribution
Fix restore XML paths to match backup block structure
Feb 27, 2026
Copilot
AI
changed the title
Fix restore XML paths to match backup block structure
Fix restore path elements to match Moodle block backup XML structure
Feb 27, 2026
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Copilot
AI
changed the title
Fix restore path elements to match Moodle block backup XML structure
Fix role filtering in auto-distribution observers
Feb 27, 2026
This reverts commit 1cf7472.
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Co-authored-by: richardwolfmayr <24298463+richardwolfmayr@users.noreply.github.com>
Copilot
AI
changed the title
Fix role filtering in auto-distribution observers
Fix auto-distribution to check student role via ad-hoc task
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-distribution was triggered on any enrollment regardless of role, unlike manual distribution which correctly filters by student role. Additionally, enrollment isn't complete when the observer fires, causing the role check to fail.
Changes
Ad-hoc task for deferred execution (
classes/task/distribute_to_user_task.php)Enrollment check function (
lib/lib.php)Observer updates (
classes/observer.php,db/events.php)user_enrolment_createdanduser_enrolment_updatedevents for role changesDistribution now only occurs for users enrolled with "student" role shortname in the specific course, matching manual distribution behavior.
Original prompt
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.