Skip to content

Conversation

@owenherbert-catalyst
Copy link
Contributor

@owenherbert-catalyst owenherbert-catalyst commented Oct 28, 2025

This merge requests adds bulk unenrol from stream functionality to the mod_facetoface plugin. The current plugin implementation only allows a user to cancel a signup one by one.

Other MR: #260

Preview:
image

What's changed?

  • Added language strings.
  • Added cancel all bookings button.
  • Added form handling.
  • Added event handling.
  • Added email handling.
  • Added unit testing.

Testing instructions:

#1. [DEV] Create a fresh 4.5 Moodle installation and setup admin user:

git clone -b MOODLE_405_STABLE [email protected]:moodle/moodle.git 45ftftest
$DOCKER_DEV_ROOT/sites/45ftftest
cd $DOCKER_DEV_ROOT/sites/45ftftest      
git clean -ffd && git submodule sync && git submodule update --init --recursive --force --jobs 16
control add 45ftftest --db mysql
control install 45ftftest --adminuser "admin" --adminpass "admin"

#2. [ADMIN] Using the admin user create a student user with student priveleges.

#3. [DEV] Install the mod_facetoface plugin using the feature branch "bulk-unenrol-from-stream"

#4. [ADMIN] Create the face-to-face activity:
- Create a test course
- Navigate to the course you want to test.
- Click “Add an activity or resource”.
- Select Face-to-Face and click Add.
- Fill in the required fields: name, description, etc.
- Save and return to the course.

#5. [ADMIN] Add multiple test sessions:
- Open the Face-to-Face activity.
- Go to Manage sessions.
- Add multiple sessions:
-- Include at least two future sessions (for bulk cancellation).
-- Optionally, include one past session to test skipping past sessions.
- Save the sessions.

#6. [ADMIN] Configure signup type for multiple sessions:
- In the Face-to-Face activity settings, set "Signup type" to Multiple.
- Save changes.

#7. [STUDENT] Add multiple signups:
- As a student (or test user), navigate to the Face-to-Face activity.
- Click the “Sign up for stream” button.
- Sign up for all upcoming sessions.
- Confirm that the student is listed in the attendance page for all sessions.

#8. [STUDENT] Test single signup cancellation:
- Navigate to Manage attendance / Sessions.
- For a single session, click Cancel signup.
- Confirm the cancellation.
- Verify:
-- The student is removed from that session.
-- Any notification emails (if enabled) are sent correctly.

#9. [STUDENT] Test bulk signup cancellation:
- Navigate to the Face-to-Face activity.
- On top of the sessions table there should be a 'cancel all' button (linked to cancelsignup.php?f=ID).
- Click the bulk cancel button.
- Confirm the cancellation in the dialog (“Cancel all sessions?”).
- Verify:
-- All future sessions are now cancelled for the student.
-- Any past sessions remain unchanged.
-- A success message appears.
-- Attendance page updates correctly.
-- The cancel all button disappears if there is nothing to cancel.
- Confirm that if you change the "Signup type" setting back to "Single" the cancel all button no longer displays.

#10. [DEV] Run unit tests
control initphpunit 45ftftest
control web 45ftftest
vendor/bin/phpunit --filter cancel_signup_test
vendor/bin/phpunit

. get_string('cancellationsentmgr', 'facetoface');

// Handle bulk signup cancellation
if (!empty($fromform->f)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this conditional does not include the logging and event triggers.

Copy link
Contributor

@golenkovm golenkovm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @owenherbert-catalyst

My main concern is the location of the Button to Cancel all bookings. I believe it should be redered once, same as Sign-up for stream, above the session list. Required/optional params for cancelsignup.php will have to be revisited as well.

One more minor thing is that the testing instructions seem to have missing the step where Signup type is set to Multiple.

Cheers,
Misha

@owenherbert-catalyst
Copy link
Contributor Author

owenherbert-catalyst commented Nov 5, 2025

Hi @golenkovm ,

  • Cancel all button placement has been adjusted as requested. See new screenshot on merge request.
  • Required and optional parameters for cancelsignup.php have been revised.
  • Added an additional testing step 6 for enabling multiple signups.

Can I please get some clarification for this point same as Sign-up for stream, above the session list?

@matthewhilton
Copy link
Contributor

Heads up I fixed the existing codechecker issues in a different PR, so you should be able to get the CI green now 🟢

@golenkovm
Copy link
Contributor

Thanks @owenherbert-catalyst Please find a few edge cases I found:

  1. When Multiple signup method is set to Per session, as a student I can sign up to multiple sessions including Wait-listed. However, when I cancel all bookings the Wait-listed is not being cancelled. Could you please fix this?
  2. When Multiple signup method is set to Per activity, as a student I am being signed up even to hidden sessions when I click Sign-up for stream. I'm not sure if it's expected behaviour, but when I click Cancel all bookings the hidden session is being cancelled as well (which is good). I guess we can retain this cancellation behaviour.

Regarding button location:

  1. Was it meant to locate the button in the "Upcoming sessions" section? The comment in the code kinda says that and I think this is the right place (next to or under the "Sign-up for stream"). Currently the button is sitting between "All sessions in.." and "Upcoming sessions" headers.
  2. I personally like the button-looking style, but it seems like all other buttons/action links are rendered as links. I feel like we should render the Cancel all booking the same way:
image

Cheers,
Misha

@owenherbert-catalyst
Copy link
Contributor Author

Hi @golenkovm , I've taken another look through this and have addressed the points you raised:

  • Moved cancel all button
  • Fixed logic error for wait listed sessions
  • Added event logging logic

@golenkovm
Copy link
Contributor

Thanks @owenherbert-catalyst Gave it a test and in general it looks good. The only thing I picked up is that the button is being rendered even if Signup type set to single. I'm kinda on the fence, but it feels a bit redundant. If we set Signup type to Single we don't render Sign-up for stream button and therefore shouldn't render "Cancel all bookings" one. Let me know your thoughts.

Cheers,
Misha

@owenherbert-catalyst
Copy link
Contributor Author

Hi @golenkovm , I'm on the fence too. I think we should render it, it makes debugging easier and also adds a quick and repeatable action for students.

@owenherbert-catalyst owenherbert-catalyst marked this pull request as ready for review November 27, 2025 03:25
@golenkovm
Copy link
Contributor

Hey @owenherbert-catalyst

Sorry, I might confused you in our internal comms. What I actually meant is #261 (comment) - If we set Signup type to Single we shouldn't render "Cancel all bookings". With the latest patch when I set Multiple; Per session the "Cancel all bookings" is not rendered but it would be helpful.

Can you please tweak the patch so Cancell all bookings button is rendered when Signup type set to Multiple (with Multiple signup method either Per activity or Per session) and there are sessions booked (there is something to actually cancel).

Thanks,
Misha

@owenherbert-catalyst
Copy link
Contributor Author

Hi @golenkovm , I've just pushed and tested those changes on my environment and they now meet those conditions.

Copy link
Contributor

@golenkovm golenkovm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @owenherbert-catalyst merging

@golenkovm golenkovm merged commit 361a5cf into MOODLE_403_STABLE Dec 4, 2025
19 checks passed
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

Successfully merging this pull request may close these issues.

4 participants