Closed (fixed)
Project:
Recurring Events
Version:
8.x-1.x-dev
Component:
Recurring Events Views (Submodule)
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2020 at 23:37 UTC
Updated:
31 Jul 2020 at 16:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
owenbush commentedAssuming what you want to do is filter out event instances that do not have any spaces left available (registrations are full)?
If so, then there is no way to do that currently, but it shouldn't be too difficult to achieve with a custom view filter. I can try and take a look at this for you soon.
Comment #3
tylvis commentedSorry for my awkward explanation. Would be great if there was a solution.
Thank you very much for the great module.
Thanks.
Comment #4
mrpauldriver commentedI've been thinking about this myself and different scenarios come to mind.
Yes, there is a case for hiding 'sold out' events, but there is also a case for maintaining visibility, but greying them out or otherwise labelling them as sold out. From a presentation angle, some css classes would also be helpful.
We also have to think about wait lists.
Comment #5
tylvis commentedIs it possible to specify a Field Inheritance (e.g. privacy boolesch-field) in the registration form and depending on whether this field has been filled in, this data is then saved in the Event Instance entity?
Then I can use the boolesch-field (Event Instance entity) as a filter in events-views.
Comment #6
owenbush commentedTylvis - I'm not sure I follow your last request. Is that related to filtering events based on whether the event is full? If not, it might be better breaking it out into a separate issue so it does not get lost in this issue.
Comment #7
owenbush commentedThis is actually proving to be harder than I thought. I was easily able to add view fields to display the number of registrations, waitlisted users, and available spaces.
The problem is that because you can register either for the instance, or the entire series, there is no simple MySQL query you can write to fetch the number of registrations etc because your view may contain a mix of series registration events and instance registration events.
You cannot filter on a computed field, which would be the obvious way to do it (and is the way I've done for the fields themselves). So I'll need to think on this one and see what can be done.
Comment #8
tylvis commentedCan the module Views Field View help here?
Comment #9
owenbush commentedViews Field View I don't think has the ability to create filters, it can add fields to a view based on another view, but not allow the view to be filtered.
I have code written to allow adding the number of waitlisted users, registered users, and spaces available to a view - but you cannot filter by them at this time, you can only display them.
I'm still thinking through how I could achieve filtering. I think i have an idea but need some time to figure it out.
For Paul's request about adding CSS classes if an event is full, that should be possible in twig I would imagine. If you add the new field I've created (when I submit the patch) you could then override the view row twig template for this view, and then dynamically add a class to the row if the availability is 0.
Comment #10
the_glitch commentedI'm guessing displays for this kind of filtering would need to have some sort of configurable CSS classes with settings such as "Hide Full Event", "Grey Out Full Event" and "Full but accepting waitlist reserves" because of the fact that if an event has waitlisting enabled you wouldn't want to hide that event.
Is it possible to somehow put the Spaces Available value into a field which could then be used as a filter in views which is triggered when the value reaches 0?
... and would then display using the CSS depending on which class was selected in the Series form?
Comment #11
owenbush commentedDisplaying a field for Spaces Available is easy (I have that code ready to go)
But there is a difference between a field and a filter which makes this tricky.
Effectively a field can be computed at display time, this is a good way to do the Spaces Available because I can programmatically grab the most up-to-date registration counts and display them.
The problem is computed fields do not have database fields or tables associated with them, so filtering is not really possible (there are ways around it with some clever joins) but effectively the issue is made difficult by registrations being for entire series or instances, we need to check the series to know what type of registration an event uses in order to calculate the registration counts.
I have some thoughts but need to experiment.
Comment #12
the_glitch commentedWhen will the Spaces Available field be released in an update?
Comment #13
owenbush commentedAttached is a patch which adds the following:
- A view field to display the number of registrations for an event instance (or series if it is a series registration event)
- A view field to display the number of waitlisted users for an event instance (or series if it is a series registration event)
- A view field to display the amount of spaces available (effectively capacity - registrations) for an event instance (or series if it is a series registration event)
- A view filter to filter event instances either by those which have availability, or those that are full. This filter is exposable too.
Marking this as 'needs review'.
Comment #14
the_glitch commentedSo far so good.
However, having the words "Event Instance" as a prefix in the view field labels is a little superfluous.
Still have to test the filter.
Comment #15
owenbush commentedI have updated the patch to remove the superfluous "Event Instance" from the field and filter labels.
I've provided an interdiff to show the changes.
Comment #16
mrpauldriver commentedPlease see this related bug report. #3155635: Event at capacity message is seen when it should not be
Comment #17
mrpauldriver commentedAnother related bug report - #3155644: Can not add Event Registration (capacity) field to event instance admin view
Comment #18
mrpauldriver commentedThese view fields will be very useful, but the they are not reliable when Tag based view caching is enabled. Can this be resolved somehow? Or would caching be better disabled by default - it is an admin view after all and not one which effects frontend performance.
As discussed in #3155644: Can not add Event Registration (capacity) field to event instance admin view I think that capacity should be added to this patch, as it is totally related.
Comment #19
owenbush commentedPaul, can you describe what you are seeing with caching - I'll presume that when the view is tag cached you're not seeing the values update even when adding more registrations? I can take a look at the caching but my presumption would be that if the view as a whole is cached then we'd have to figure out how to invalidate the caches for the view results when registrations are added/removed, which may or may not be simple. But I'll take a look. Certainly not caching would be a workaround for now.
I'll look into the capacity field for you.
Comment #20
mrpauldriver commentedYes, that's correct.
Comment #21
owenbush commentedAttached is a patch with several fixes.
I've added the 'Capacity' field so it can be displayed in views. I also hid all the other Event Registration fields, because they do not actually work in views at this time, capacity is a special case. I also did the same with the recurring date fields, as those are not easily displayable in views.
I added some cache tag clearing of event series and event instances when creating or deleting registrants, which should keep those values in the view up to date.
I fixed the issue with waitlist count and registration count only ever being '1'
I modified the messaging a little when someone registers for an event and takes the last spot. It seemed to me that the message was being displayed but that it was confusing when you saw the form now saying "We cannot complete your registration" it now says "Registration Full".
Comment #24
owenbush commentedGiven this has been outstanding for a while I've gone ahead and merged it so its no longer a blocker for other work. If there are still issues then we should address those in a separate issue if possible.
Thanks for all involved.
Comment #25
mrpauldriver commentedAgh. I was just about to test and review. I've been busy with client work :-)