Problem/Motivation

Currently in recurring_events_registration there's a boolean views filter for whether an event instance has availability or not for registration. It might be handy to add a numeric filter (e.g. there are 2 or greater available slots for registration for an event instance) since there's likely common use cases for this (especially re: the 'add guests' feature request in https://www.drupal.org/project/recurring_events/issues/3257502).

Proposed resolution

Attached patch adds a numeric views filter "Registration Availability Count" for event instance views.

Comments

bgilhome created an issue. See original summary.

bgilhome’s picture

Some users might also want a contextual argument (e.g. could be used with Contextual Range Filter module (https://www.drupal.org/project/contextual_range_filter) to filter a range of availability counts) - updated patch & interdiff attached.

bgilhome’s picture

I forgot to add the views_data diff - here's the updated patch and interdiff to 1.

owenbush’s picture

This is good stuff, thank you. I wonder if it is worth waiting until #3264621: Use computed fields for availability, registrations & waitlist counts is merged, so this can be updated to use the computed fields.

owenbush’s picture

owenbush’s picture

Status: Needs review » Needs work

This is now probably ready to be updated to use the computed fields. I'll take a look this week.

owenbush’s picture

Status: Needs work » Needs review
StatusFileSize
new7.46 KB
new10.88 KB

Attached is a new patch and an interdiff. Basically all I changed was to no longer need the RegistrationCreationService because we now have a computed field to determine the availability for an event, and then I also tweaked the logic in some of the operators to take into account the fact that some events can have an unlimited (-1) capacity.

For example filtering for any event with:

1. More than X spaces - should always return the unlimited events
2. Less than X spaces- should never return the unlimited events
3. Between X and Y spaces - should never return the unlimited events
4. Not between X and Y spaces - should always return the unlimited events
etc.

bgilhome’s picture

That's great! Thanks @owenbush!

  • owenbush committed 8285765 on 2.0.x
    Issue #3265779 by bgilhome, owenbush: Add numeric views filter for...

  • owenbush committed 67cd004 on 8.x-1.x
    Issue #3265779 by bgilhome, owenbush: Add numeric views filter for...
owenbush’s picture

Status: Needs review » Fixed

This has been merged into the latest dev branches 8.x-1.x and 2.0.x

Status: Fixed » Closed (fixed)

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