Repository navigation
Conversation
…the order for tickets missing it
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-649/ This page is automatically updated on each push to this PR. |
…t.SummitID and compute the histogram once Replace SummitOrder.SummitID with SummitAttendeeTicket.SummitID (indexed) in the ticket and refund queries and drop the SummitOrder join where it only carried the summit filter. getTotalOrdersCount still counts orders, so it keeps its filter. getPurchasedTicketsGroupedBy no longer wraps the histogram in COUNT(*) to get the total: the buckets are counted and paged in PHP. Document that the histogram uses a single fixed summit offset (known limitation, behavior unchanged).
…ummit and date range The lifetime comes from cache_api_response.registration_stats_response_lifetime (CACHE_API_RESPONSE_REGISTRATION_STATS_LIFETIME, default 600). A value of 0 disables the cache.
…in and the response cache
18e9fdd to
0fc1b24
Compare
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-649/ This page is automatically updated on each push to this PR. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Summary
ref: https://app.clickup.com/t/86bcjg0u6
The admin dashboard polls
GET /api/v1/summits/all/{id}/registration-statsabout every 44 s and each call runs 16 raw SQL queries. Almost all of them filtered onSummitOrder.SummitID, which makes the optimizer scanSummitAttendeeTicketand probeSummitOrderonce per ticket.SummitAttendeeTicket.SummitIDfrom the order for tickets that have an order but no summit.SummitAttendeeTicket.SummitID(existing index) and drop theSummitOrderjoin where it only carried the summit filter.getTotalOrdersCountcounts orders, so it keepsSummitOrder.SummitID.getPurchasedTicketsGroupedByno longer runs the histogram a second time insideCOUNT(*). The buckets are counted and paged in PHP.CACHE_API_RESPONSE_REGISTRATION_STATS_LIFETIME(default 600,0disables it).Known limitation (unchanged)
The purchased-tickets histogram uses a single fixed offset for the whole summit, the one in effect on its begin date. Tickets bought under a different offset (e.g. across a DST change) can land in the neighbouring bucket. Behavior is kept on purpose to return the same payload as before. It is documented above
getTimeZoneOffset()and pinned by a test.Tests
New, run locally in the
summit-apicontainer, all passing:tests/Repositories/RegistrationStatsPayloadTest.php(5 tests): results compared with the oldSummitOrderjoin, including a ticket bought at 23:30 local time and one on the DST change day.tests/Repositories/RegistrationStatsCacheTest.php(4 tests): one execution inside the lifetime, re-run after expiry,LIFETIME=0, different date ranges.tests/oauth2/OAuth2SummitApiTest.phpfails entirely, with and without this change: itstearDowncallsclearSummitTestData()withoutclearOrdersTestData(). The bodies oftestGetCurrentSummitRegStatsandtestGetAttendeesCheckinsOverTimeStatsran their assertions. I did not touch that file.Deployment notes
Version20261021120000runs a singleUPDATE ... JOIN SummitOrderonSummitAttendeeTicket(only rows with an order and a NULLSummitID; 2 rows expected on prod, both summit 69). It must be applied together with this release, because the queries now rely onSummitAttendeeTicket.SummitID.down()is a no-op, so a rollback does not undo the backfill (harmless).CACHE_API_RESPONSE_REGISTRATION_STATS_LIFETIME, in seconds, default600. No action needed to get the default. Added to.env.example.0and restart to go back to live counts without a deploy.CACHE_DRIVER=redis). Entries are keyed per summit, date range and expand/fields/relations, and expire by TTL; nothing invalidates them earlier.IDX_SummitAttendeeTicket_SummitID.SELECT COUNT(*) FROM SummitAttendeeTicket WHERE SummitID IS NULL AND OrderID IS NOT NULLreturns 0, and compare the digests of the registration stats queries on prod-12.Not verified
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests