membershipworks: Use Non-Member ticket price when Member price is 0
This commit is contained in:
parent
b60d9f6644
commit
5e4ab7a58a
@ -687,25 +687,31 @@ class EventTicketTypeManager(models.Manager["EventTicketType"]):
|
||||
)
|
||||
qs = super().get_queryset()
|
||||
return qs.annotate(
|
||||
members_price=Subquery(
|
||||
qs.filter(event=OuterRef("event"), restrict_to=members_folder).values(
|
||||
"list_price"
|
||||
),
|
||||
output_field=models.FloatField(),
|
||||
),
|
||||
# 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.
|
||||
# for all tickets except where members ticket is free.
|
||||
actual_price=Case(
|
||||
When(
|
||||
# member ticket
|
||||
Q(restrict_to=members_folder)
|
||||
| (
|
||||
Q(event__start__lt=datetime(year=2024, month=7, day=1))
|
||||
& Q(restrict_to__isnull=True)
|
||||
# non-member ticket
|
||||
Q(restrict_to__isnull=True)
|
||||
& (
|
||||
Q(event__start__lt=datetime(year=2024, month=7, day=1))
|
||||
| Q(members_price=0)
|
||||
)
|
||||
),
|
||||
"list_price",
|
||||
),
|
||||
default=Subquery(
|
||||
qs.filter(
|
||||
event=OuterRef("event"), restrict_to=members_folder
|
||||
).values("list_price"),
|
||||
output_field=models.FloatField(),
|
||||
),
|
||||
default="members_price",
|
||||
),
|
||||
is_members_ticket=(Q(restrict_to__isnull=False)),
|
||||
materials=Case(
|
||||
|
Loading…
Reference in New Issue
Block a user