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

View file

@ -445,20 +445,15 @@ if DEV_MODE and DEV_MODE == "LAPTOP":
from .devmode_settings import * from .devmode_settings import *
# Ticket information # 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) @dataclass(frozen=True)
class Ticket: class Ticket:
name: str name: str
regular_price: Decimal regular_price: Decimal
earlybird_price: Decimal earlybird_price: Decimal
def earlybird_discount(self):
return self.regular_price - self.earlybird_price
@dataclass(frozen=True) @dataclass(frozen=True)
class PenguinDinnerTicket: class PenguinDinnerTicket:
@ -467,6 +462,22 @@ class PenguinDinnerTicket:
description: str 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")) CONTRIBUTOR = Ticket("Contributor", Decimal("1999.00"), Decimal("1849.00"))
PROFESSIONAL = Ticket("Professional", Decimal("1099.00"), Decimal("949.00")) PROFESSIONAL = Ticket("Professional", Decimal("1099.00"), Decimal("949.00"))
HOBBYIST = Ticket("Hobbyist", Decimal("549.00"), Decimal("399.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"), PENGUIN_DINNER_ADULT = PenguinDinnerTicket("Adult", Decimal("95.00"),
"Includes an adult's meal and full beverage service.") "Includes an adult's meal and full beverage service.")
PENGUIN_DINNER_CHILD = PenguinDinnerTicket("Child", Decimal("50.00"), 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"), PENGUIN_DINNER_INFANT = PenguinDinnerTicket("Infant", Decimal("0.0"),
"Includes no food or beverage service.") "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.")