Currently, in the default configuration, registrations with a state of 'canceled' will be included in the event count. If your event has a capacity set, then it'll stop letting people register before having enough active registrations!
The right thing to do, would be to only include states which are 'Active' or 'Held' in the event count.
There is some code in registration_event_count() which looks like it was intended to do exactly that:
$active_held_states = registration_states(array('held' => TRUE, 'active' => TRUE));
if (!empty($active_held_states)) {
$query->condition('state', $active_held_states, 'IN');
}
However, $active_held_states will always be an empty array, because that call to registration_states() is attempting to return states which are BOTH active and held, which is not possible.
Also, registration_states() returns full registration state entities, not just the names, so even if it did return the right states, the query wouldn't be right anyway.
I'll post a patch to fix in a moment!
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | registration-canceled-count-2497203-1.patch | 986 bytes | dsnopek |
Comments
Comment #1
dsnopekPatch is attached! Please let me know what you think. :-)
Comment #2
.bert commentedThis could probably be marked as a duplicate of this issue:
https://www.drupal.org/node/2496559
The patch provided in that issue does the same thing as your patch, except makes use of the
registration_get_active_states()andregistration_get_held_states()functions, which already return arrays with state names only.Comment #3
dsnopekAh, yeah, you're patch is shorter and functionally equivalent so let's say this is a duplicate:
#2496559: Event Count not accurately counting active/held states
Sorry I didn't notice yours before I started work on mine!
Comment #4
.bert commentedAll good. They were right around the same time and good to see we're on the same page.