membershipworks: Apply new "Members" ticket-based pricing to classes after 2024-07-01
All checks were successful
Ruff / ruff (push) Successful in 1m32s
Test / test (push) Successful in 5m17s

This commit is contained in:
Adam Goldsmith 2024-06-27 15:54:13 -04:00
parent 682ebefc81
commit a49466a93a

View File

@ -680,13 +680,19 @@ class EventTicketTypeManager(models.Manager["EventTicketType"]):
) )
qs = super().get_queryset() qs = super().get_queryset()
return qs.annotate( return qs.annotate(
# Before 2024-07-01, use Members ticket price for any
# restricted ticket, but list price for unrestricted
# (Non-Members) ticket. After, use Members ticket price
# for all tickets.
actual_price=Case( actual_price=Case(
When( When(
Q(restrict_to=members_folder) | Q(restrict_to__isnull=True), Q(restrict_to=members_folder)
| (
Q(event__start__lt=datetime(year=2024, month=7, day=1))
& Q(restrict_to__isnull=True)
),
"list_price", "list_price",
), ),
# Use Members ticket price for any restricted ticket
# which is not the Members ticket
default=Subquery( default=Subquery(
qs.filter( qs.filter(
event=OuterRef("event"), restrict_to=members_folder event=OuterRef("event"), restrict_to=members_folder