membershipworks: Ignore EventExt.materials_fee_included_in_price when materials fee is 0
All checks were successful
Ruff / ruff (push) Successful in 21s

This commit is contained in:
Adam Goldsmith 2024-02-03 23:33:19 -05:00
parent 560225cdb3
commit 824c37df04

View File

@ -592,10 +592,10 @@ class EventTicketTypeManager(models.Manager["EventTicketType"]):
),
is_members_ticket=(Q(restrict_to__isnull=False)),
materials=Case(
When(Q(event__materials_fee_included_in_price__isnull=True), None),
When(
(
Q(event__materials_fee_included_in_price=True)
| Q(event__materials_fee=0)
& Q(event__materials_fee__isnull=False)
),
ExpressionWrapper(
@ -603,6 +603,7 @@ class EventTicketTypeManager(models.Manager["EventTicketType"]):
output_field=models.DecimalField(),
),
),
When(Q(event__materials_fee_included_in_price__isnull=True), None),
default=0,
output_field=models.DecimalField(),
),