How do I show how many slots are available, or that an event is fully booked?
Registration status always returns open, and I can't see the capacity field in views or rules. The capacity value is updated correctly in the database, and registrations are working.
I can only see that an event is full when trying to register for it, where the module correctly states that there are insufficient slots remaining for this event.

I don't know whether these are separate issues, but they seem related.

Comments

MortenP’s picture

Category: support » bug

In function registration_has_room line 574, the check

if (($capacity - $count) < 0) {

seems wrong to me, at least in my case $count can never be greater than $capacity.

Status returns the correct value when I change it to

if (($capacity - $count) <= 0) {

MortenP’s picture

My workaround for the missing capacity in views was using Views PHP module:

$registrations = db_query("SELECT COUNT(*) FROM {registration} WHERE entity_id IN ($row->nid)")-> fetchField();
$capacity = db_query("SELECT capacity FROM {registration_entity} WHERE entity_id IN ($row->nid)")-> fetchField();

$remaining = $capacity - $registrations;

if ($remaining < 1){
$remaining = '<span class="full-event">Full</span>';
}

print $remaining;
levelos’s picture

Status: Active » Postponed (maintainer needs more info)

The status on a registration entity only governs whether a particular instance of a registration entity is active and counted against totals, used in broadcasts, etc.

Capacity and an event's overall ability to receive additional registrations is governed by a function, registration_status(). This status value is made available in the Views handler provided with registration_views, registration_handler_field_entity_registration_status. Capacity is also available in Views via the same module.

That explained, is there still an issue here?

levelos’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
sportel’s picture

I believe the original question was how to show the capacity, or remaining slots available. It might be my bad understanding of drupal/views/ER, but I'm still not sure on how to show the capacity in Views. I can add the Slots Used field and the Registration Status field, but thats it.
But as I said, it's probebly just me, so if you could give me some hints...

Thanks,

Mike.

mrpauldriver’s picture

Create a view displaying fields of your registration content types

Add a relationship of Registration Settings: Node to Registration Settings (filter by Registration Settings)

You should have access two fields 'Slots Total' and 'Spaces Used' which you can add to your view

plusproduit’s picture

Issue summary: View changes

Thanks MrPaulDriver, very useful!

However I had to use a view type Content to show capacity when nobody's registered.