-
-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Describe the bug
The admin edit view for an event (/admin/events/events/{ticketType}/45081) which has a large number of purchased tickets is using an excessive amount of memory, leading to slow load times and loading errors. In order to avoid breaking, I am temporarily increasing my php memory limit, but it is still a very slow query that bogs down the server.
My particular event has 5,000+ purchased tickets, including 4 different ticket types.
The culprit appears to be coming from the file src/templates/events/_edit.html on line 210:
{% set purchasedTickets = craft.events.purchasedTickets.eventId(event.id).all() %}
These are then looped through to get the total count of purchased tickets by ticket type.
There should be a more efficient way to query the database and get the ticket count for each ticket type, without having to load all 5000+ ticket elements and loop through them.
Steps to reproduce
- Create an Event
- Purchase a large number of tickets for the event (5,000+)
- Access the event edit page in the admin panel
Craft CMS version
4.16.16
Plugin version
2.0.11
Multi-site?
No response
Additional context
No response