Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
In case I have an entity with 2 slots +1 in the waiting list enabled, registration_status() returns false if there is one (non wait list) registration and one (wait list) registration. This can happen in case a user who register on the main list then cancel/delete his registration. In my opinion, it should return true since the total number of slots have not been filled yet.
To do so, replace (in waiting_list.module)
<?php
// We only need to check how many people are on the waitlist if there is a capacity other than 0 set
if ($active && $waitlist_capacity) {
$waitlist_state = registration_get_states(REGISTRATION_WAITLIST_STATE);
// get count of registrations with the waitlist state
$query = db_select('registration', 'r');
$query->addExpression('sum(count)', 'count');
$query->condition('entity_id', $entity_id);
$query->condition('entity_type', $entity_type);
$query->condition('state', $waitlist_state->identifier());
$result = $query->execute();
$waitlist_count = $result->fetchField();
$waitlist_count = ($waitlist_count == '') ? 0 : $waitlist_count;
if (($waitlist_capacity - $waitlist_count) < 1) {
$active = FALSE;
$errors[] = t('waitlist is full');
}
}
?>
by
<?php
// We only need to check how many people are on the waitlist if there is a capacity other than 0 set
if ($active && $waitlist_capacity) {
$waitlist_state = registration_get_states(REGISTRATION_WAITLIST_STATE);
$canceled_state = registration_get_states('canceled');
// get count of registrations with the waitlist state
$query = db_select('registration', 'r');
$query->addExpression('sum(count)', 'count');
$query->condition('entity_id', $entity_id);
$query->condition('entity_type', $entity_type);
// $query->condition('state', $waitlist_state->identifier());
$query->condition('state', $canceled_state->identifier(), '<>');
$result = $query->execute();
$total_count = $result->fetchField();
$total_count = ($total_count == '') ? 0 : $total_count;
// compare the total number of registrations to the sum of capacity and waiting list capacity
// allow to handle the case where normal applications have been deleted.
if (($capacity + $waitlist_capacity - $total_count) < 1) {
$active = FALSE;
$errors[] = t('waitlist is full');
}
}
?>
Please tell me if it is a bug or if it works as designed.
EDIT: patch provided.
Comment | File | Size | Author |
---|---|---|---|
#1 | registration-waiting_list-countdown-2189169-1.patch | 1.53 KB | julou |
Comments
Comment #1
julou CreditAttribution: julou commentedComment #2
gcbI agree that this behavior is not ideal, but it seems like the correct way to deal with it is actually to convert the oldest waitlist registration into a full registration in this case.
Comment #3
gandhiano CreditAttribution: gandhiano commentedThe patch on #1 (applied on 7.x-1.3) is not working for me, I still always get an:
Error message: Sorry, unable to register for SOME EVENT due to: insufficient spaces remaining.
Even if there is only people in the waiting list (after deleting the completed ones).
Pushing priority up, since this makes the waitlist submodule basically unusable.
Comment #4
alibama CreditAttribution: alibama commentedyeah - having problems with waitlist - i'm considering removing from my site as it doesn't really work...
Comment #5
Renee S CreditAttribution: Renee S commentedI solved this by creating a rule that moves people off the waitlist. Perhaps give this a shot? #2481203: Make module more waitlist-aware, bonus: making waitlist work!
ETA: Now there's this solution too: https://www.drupal.org/node/2258117
Comment #6
dsnopekI'm pretty sure this is a duplicate of #2496559: Event Count not accurately counting active/held states. The main module is counting the number of registered participants wrong - this shouldn't require changing registration_waitlist to account for the waitlisted registrations.
But if I've got this wrong, please feel free to re-open this issue! :-)