moved just about all the ticket details from code to settings.

This commit is contained in:
Clinton Roy 2019-09-22 17:15:23 +10:00 committed by Joel Addison
parent 8235ffca6c
commit cf7e67a747
2 changed files with 43 additions and 23 deletions

View file

@ -325,9 +325,9 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.speakers_dinner_ticket,
name="Adult",
description="Includes an adult's meal and full beverage service.",
price=Decimal("100.00"),
name=settings.SPEAKERS_DINNER_ADULT.name,
description=settings.SPEAKERS_DINNER_ADULT.description,
price=settings.SPEAKERS_DINNER_ADULT.price,
reservation_duration=hours(1),
order=10,
)
@ -335,9 +335,9 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.speakers_dinner_ticket,
name="Child",
description="Children 14 and under. Includes a child's meal and soft drink service.",
price=Decimal("60.00"),
name=settings.SPEAKERS_DINNER_CHILD.name,
description=settings.SPEAKERS_DINNER_CHILD.description,
price=settings.SPEAKERS_DINNER_CHILD.price,
reservation_duration=hours(1),
order=20,
)
@ -345,10 +345,9 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.speakers_dinner_ticket,
name="Infant",
description="Infant must be seated in an adult's lap. No food or "
"beverage service.",
price=Decimal("00.00"),
name=settings.SPEAKERS_DINNER_INFANT.name,
description=settings.SPEAKERS_DINNER_INFANT.description,
price=settings.SPEAKERS_DINNER_INFANT.price,
reservation_duration=hours(1),
order=30,
)
@ -419,7 +418,7 @@ class Command(BaseCommand):
("name", "category",),
name=product_name,
category=self.t_shirt,
price=Decimal("25.00"),
price=settings.TSHIRT_PRICE,
reservation_duration=hours(1),
order=order,
)
@ -694,7 +693,7 @@ class Command(BaseCommand):
("discount", "product"),
discount=discount,
product=self.ticket_contributor,
price=settings.CONTRIBUTOR.regular_price - settings.CONTRIBUTOR.earlybird_price,
price=settings.CONTRIBUTOR.earlybird_discount(),
quantity=1, # Per user
)
self.find_or_make(
@ -702,7 +701,7 @@ class Command(BaseCommand):
("discount", "product"),
discount=discount,
product=self.ticket_professional,
price=settings.PROFESSIONAL.regular_price - settings.PROFESSIONAL.earlybird_price,
price=settings.PROFESSIONAL.earlybird_discount(),
quantity=1, # Per user
)
@ -729,7 +728,7 @@ class Command(BaseCommand):
("discount", "product"),
discount=early_bird_hobbyist_discount,
product=self.ticket_hobbyist,
price=settings.HOBBYIST.regular_price - settings.HOBBYIST.earlybird_price,
price=settings.HOBBYIST.earlybird_discount(),
quantity=1, # Per user
)

View file

@ -445,20 +445,15 @@ if DEV_MODE and DEV_MODE == "LAPTOP":
from .devmode_settings import *
# Ticket information
LCA_START = datetime(2020, 1, 13)
LCA_END = datetime(2020, 1, 17)
EARLY_BIRD_DEADLINE = datetime(2019, 11, 1)
PENGUIN_DINNER_TICKET_DATE = date(2020, 1, 15)
SPEAKER_DINNER_TICKET_DATE = date(2020, 1, 14)
PDNS_TICKET_DATE = date(2020, 1, 16)
@dataclass(frozen=True)
class Ticket:
name: str
regular_price: Decimal
earlybird_price: Decimal
def earlybird_discount(self):
return self.regular_price - self.earlybird_price
@dataclass(frozen=True)
class PenguinDinnerTicket:
@ -467,6 +462,22 @@ class PenguinDinnerTicket:
description: str
@dataclass(frozen=True)
class SpeakersDinnerTicket:
name: str
price: Decimal
description: str
LCA_START = datetime(2020, 1, 13)
LCA_END = datetime(2020, 1, 17)
EARLY_BIRD_DEADLINE = datetime(2019, 11, 1)
PENGUIN_DINNER_TICKET_DATE = date(2020, 1, 15)
SPEAKER_DINNER_TICKET_DATE = date(2020, 1, 14)
PDNS_TICKET_DATE = date(2020, 1, 16)
TSHIRT_PRICE = Decimal("25.00")
CONTRIBUTOR = Ticket("Contributor", Decimal("1999.00"), Decimal("1849.00"))
PROFESSIONAL = Ticket("Professional", Decimal("1099.00"), Decimal("949.00"))
HOBBYIST = Ticket("Hobbyist", Decimal("549.00"), Decimal("399.00"))
@ -486,6 +497,16 @@ CONFERENCE_VOL = Ticket("Conference Volunteer", Decimal("0.0"), None)
PENGUIN_DINNER_ADULT = PenguinDinnerTicket("Adult", Decimal("95.00"),
"Includes an adult's meal and full beverage service.")
PENGUIN_DINNER_CHILD = PenguinDinnerTicket("Child", Decimal("50.00"),
"Children 14 and under. Includes a child's meal and soft drink service.")
"Children 14 and under. "
"Includes a child's meal and soft drink service.")
PENGUIN_DINNER_INFANT = PenguinDinnerTicket("Infant", Decimal("0.0"),
"Includes no food or beverage service.")
SPEAKERS_DINNER_ADULT = SpeakersDinnerTicket("Adult", Decimal("100.00"),
"Includes an adult's meal and full beverage service.")
SPEAKERS_DINNER_CHILD = SpeakersDinnerTicket("Child", Decimal("60.00"),
"Children 14 and under. "
"Includes a child's meal and soft drink service.")
SPEAKERS_DINNER_INFANT = SpeakersDinnerTicket("Infant", Decimal("00.00"),
"Infant must be seated in an adult's lap. "
"No food or beverage service.")