If I delete a registration with "complete" status or change the status to "canceled", an existing registration with the "waitlist" status doesn't automatically change to "complete". This isn't what users expect!

There is another issue which adds Rules integration to make it possible to implement this in Rules:

#2481203: Make module more waitlist-aware, bonus: making waitlist work!

However, the registration_waitlist module is already automatically setting the status to "waitlist" when a registration is created and the capacity is already full. So, it would make sense that it would automatically do the reverse without needing to setup some special configuration with Rules!

So, I'd like to propose that the registration_waitlist module detect deleted or canceled registration and automatically set the oldest waitlist registration to "complete".

In order for this patch to actually work, you need to use a couple other patches to fix other bugs:

#2496559: Event Count not accurately counting active/held states
#2479805: Insufficient Spaces Remaining Text breaks Waitlist

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marcmueller’s picture

Same for me. Any news on this issue?

dsnopek’s picture

Title: waitlist functionality » Waitlist doesn't automatically change 'waitlist' registrations to 'complete' when slots become available
Version: 7.x-1.3 » 7.x-1.x-dev
Issue summary: View changes
Related issues: +#2481203: Make module more waitlist-aware, bonus: making waitlist work!

Updated issue summary!

dsnopek’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
3.4 KB

Here is a patch that implements my proposal! I discovered that a new hook isn't necessary or Rules to be notified when a user comes off the waitlist - you can just watch for the entity to update from 'waitlist' to 'complete' - so I removed that bit from the issue summary.

In order to actually work, you need to use a couple other patches to fix other bugs:

#2496559: Event Count not accurately counting active/held states
#2479805: Insufficient Spaces Remaining Text breaks Waitlist

dsnopek’s picture

Issue summary: View changes
FileSize
3.75 KB

Here's a new version of this patch which fixes a minor bug in hook_entity_delete() which forgot to check the status of the registration being deleted.

cboyden’s picture

Status: Needs review » Reviewed & tested by the community

This patch is working great for me.

falent’s picture

I have just found what I made wrong ;) I don't know how to delete this post

travelertt’s picture

Status: Reviewed & tested by the community » Needs work

This patch, #4, doesn't have any support for capacity or registration count.

wak’s picture

I second to have this functionality integrated into the module. For a large site with lots of registrations it is necassary to automate waitlist functions and I suppose, it is what most user assume the module should do.

Nonetheless it's possible to achieve that with a combination of Rules and VBO (Views Bulk Operations), if you prefer that to patching your module. I'm quite sure it might work with rules only too - it's not like the VBO funcitionalty is needed, but it gives an easy possiblity to expose a result of a view to rules.

1.) Create a View which has as result only the oldest member of the waitlist of a given node, that is the one, who should be promoted to "complete". How to:
-View Type "Registrations".
- Relationship "Registration: Registration to Content"
- contextual filter for the nid of the related content
- filter for State "waitlist"
- sort by registration-id
- Use pager:"Display a specified number of items|1 item".
- Format: Table.
- Fields "Bulk Operations" and "RegistrationID" should be enough.

2.) Create a rule for the event "After deleting a registration"
Condition: Data comparsion [registration:state] is complete
Action 1: Load a list of entity objects from a VBO View. Use your view from step one and give [registration:entity-id] as an argument
Action 2: Set a date value. Set the state of the fetched registration to "complete"

3.) Same way you can set up a rule which reacts on changing the state of a registration from "complete" to "cancelled".

Obviously this could be refined - e.g. check capacity or take into account the slots (we do not need that). Therefore a native solution as part of the modules would be perfect!

joelpittet’s picture

I like the idea behind this because normally it's a real time saver but if the event has different types of registrants and some have higher priority in the queue then this becomes a bug. Making this optional would be preferred.

mbaynton’s picture

@joelpittet makes a good point, doing this changes a behavior that might be depended on by some. Here's a patch to make it optional, but to start doing it as the default unless you turn it off.

joelpittet’s picture

Thanks @mbaynton, that alleviates my concern.

dsnopek’s picture

I haven't tested it, but the changes in #10 look good to me!

I'd mark as RTBC, but I wrote the patch in #4, and this went to "Needs review" in #7 because:

This patch, #4, doesn't have any support for capacity or registration count.

I actually don't think this is true? The whole thing is built around capacity and registration count. The code doesn't explicitly look at capacity and count: it's looking for the 'Insufficient spaces remaining.' error to see if the event is at full capacity. Perhaps there was confusion around that? Or maybe I'm not understanding the comment?

mbaynton’s picture

I wasn't so sure what that comment meant either; the best guess I had about what might still be lacking along those lines is that it looks like the module supports a notion of a single Registration entity that consumes more than one of the capacity slots. If that was the Registration being deleted, I don't think that number of new Registrations would be promoted, and conversely I think you could promote a Registration that consumed more slots than were actually available.

I'd wager that this feature is rarely used though, and it's easy to examine whether it might be in use through configuration - maximum slots per Registration entity can be configured to 1. Maybe just add a little code to disable autopromotion when multiple slots per Registration are in use, and get this working for the majority?

dsnopek’s picture

I just did some manual testing of the latest patch and it seems to work. :-)

john.oltman’s picture

Version: 7.x-1.x-dev » 3.0.x-dev
Category: Bug report » Feature request
Status: Needs work » Active
john.oltman’s picture

Component: Registration Core » Registration Wait List

  • john.oltman committed 25b23de9 on 3.0.x
    Issue #2258117: Change 'waitlist' registrations to 'complete' when slots...
john.oltman’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.