moving more and more prices to the settings, and outside code.

This commit is contained in:
Clinton Roy 2019-09-22 15:11:55 +10:00 committed by Joel Addison
parent a6ecaad866
commit 8235ffca6c
3 changed files with 78 additions and 36 deletions

View file

@ -170,8 +170,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Contributor",
price=Decimal("1999.00"),
name=settings.CONTRIBUTOR.name,
price=settings.CONTRIBUTOR.regular_price,
reservation_duration=hours(24),
order=1,
)
@ -179,8 +179,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Professional",
price=Decimal("999.00"),
name=settings.PROFESSIONAL.name,
price=settings.PROFESSIONAL.regular_price,
reservation_duration=hours(24),
order=10,
)
@ -188,8 +188,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Hobbyist",
price=Decimal("449.00"),
name=settings.HOBBYIST.name,
price=settings.HOBBYIST.regular_price,
reservation_duration=hours(24),
order=20,
)
@ -197,8 +197,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Student",
price=Decimal("149.00"),
name=settings.STUDENT.name,
price=settings.STUDENT.regular_price,
reservation_duration=hours(24),
order=30,
)
@ -206,8 +206,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Monday and Tuesday Only",
price=Decimal("198.00"),
name=settings.MINICONF_MT.name,
price=settings.MINICONF_MT.regular_price,
reservation_duration=hours(24),
order=40,
)
@ -215,8 +215,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Monday Only",
price=Decimal("99.00"),
name=settings.MINICONF_M.name,
price=settings.MINICONF_M.regular_price,
reservation_duration=hours(24),
order=42,
)
@ -224,8 +224,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Tuesday Only",
price=Decimal("99.00"),
name=settings.MINICONF_MT.name,
price=settings.MINICONF_MT.regular_price,
reservation_duration=hours(24),
order=44,
)
@ -233,8 +233,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Speaker",
price=Decimal("00.00"),
name=settings.SPEAKER.name,
price=settings.SPEAKER.regular_price,
reservation_duration=hours(24),
order=50,
)
@ -242,8 +242,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Media",
price=Decimal("00.00"),
name=settings.MEDIA.name,
price=settings.MEDIA.regular_price,
reservation_duration=hours(24),
order=60,
)
@ -251,8 +251,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Sponsor",
price=Decimal("00.00"),
name=settings.SPONSOR.name,
price=settings.SPONSOR.regular_price,
reservation_duration=hours(24),
order=70,
)
@ -260,8 +260,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Conference Organiser",
price=Decimal("00.00"),
name=settings.CONFERENCE_ORG.name,
price=settings.CONFERENCE_ORG.regular_price,
reservation_duration=hours(24),
order=80,
)
@ -269,8 +269,8 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.ticket,
name="Conference Volunteer",
price=Decimal("00.00"),
name=settings.CONFERENCE_VOL.name,
price=settings.CONFERENCE_VOL.regular_price,
reservation_duration=hours(24),
order=90,
)
@ -292,9 +292,9 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.penguin_dinner,
name="Adult",
description="Includes an adult's meal and full beverage service.",
price=Decimal("95.00"),
name=settings.PENGUIN_DINNER_ADULT.name,
description=settings.PENGUIN_DINNER_ADULT.description,
price=settings.PENGUIN_DINNER_ADULT.price,
reservation_duration=hours(1),
order=10,
)
@ -302,9 +302,9 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.penguin_dinner,
name="Child",
description="Children 14 and under. Includes a child's meal and soft drink service.",
price=Decimal("50.00"),
name=settings.PENGUIN_DINNER_CHILD.name,
description=settings.PENGUIN_DINNER_CHILD.description,
price=settings.PENGUIN_DINNER_CHILD.price,
reservation_duration=hours(1),
order=20,
)
@ -312,9 +312,9 @@ class Command(BaseCommand):
inv.Product,
("name", "category",),
category=self.penguin_dinner,
name="Infant",
description="Includes no food or beverage service.",
price=Decimal("00.00"),
name=settings.PENGUIN_DINNER_INFANT.name,
description=settings.PENGUIN_DINNER_INFANT.description,
price=settings.PENGUIN_DINNER_INFANT.price,
reservation_duration=hours(1),
order=30,
)
@ -694,7 +694,7 @@ class Command(BaseCommand):
("discount", "product"),
discount=discount,
product=self.ticket_contributor,
price=Decimal("150.00"),
price=settings.CONTRIBUTOR.regular_price - settings.CONTRIBUTOR.earlybird_price,
quantity=1, # Per user
)
self.find_or_make(
@ -702,7 +702,7 @@ class Command(BaseCommand):
("discount", "product"),
discount=discount,
product=self.ticket_professional,
price=Decimal("150.00"),
price=settings.PROFESSIONAL.regular_price - settings.PROFESSIONAL.earlybird_price,
quantity=1, # Per user
)
@ -729,7 +729,7 @@ class Command(BaseCommand):
("discount", "product"),
discount=early_bird_hobbyist_discount,
product=self.ticket_hobbyist,
price=Decimal("100.00"),
price=settings.HOBBYIST.regular_price - settings.HOBBYIST.earlybird_price,
quantity=1, # Per user
)

View file

@ -1,3 +1,4 @@
from decimal import Decimal
import os
import sys
@ -8,6 +9,8 @@ import saml2.saml
from datetime import date, datetime
from dataclasses import dataclass
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
DJANGO_ROOT = os.path.abspath(os.path.dirname(django.__file__))
@ -448,3 +451,41 @@ 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
@dataclass(frozen=True)
class PenguinDinnerTicket:
name: str
price: Decimal
description: str
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"))
STUDENT = Ticket("Student", Decimal("199.00"), None)
MINICONF_MT = Ticket("Monday and Tuesday Only", Decimal("198.00"), None)
MINICONF_M = Ticket("Monday Only", Decimal("99.00"), None)
MINICONF_T = Ticket("Tuesday Only", Decimal("99.00"), None)
MEDIA = Ticket("Media", Decimal("0.0"), None)
SPEAKER = Ticket("Speaker", Decimal("0.0"), None)
SPONSOR = Ticket("Sponsor", Decimal("0.0"), None)
CONFERENCE_ORG = Ticket("Conference Organiser", Decimal("0.0"), None)
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.")
PENGUIN_DINNER_INFANT = PenguinDinnerTicket("Infant", Decimal("0.0"),
"Includes no food or beverage service.")

View file

@ -9,6 +9,7 @@ chardet==3.0.4
coverage==4.0.3
cryptography==2.3
cssselect2==0.2.1
dataclasses==0.6
decorator==4.3.0
defusedxml==0.5.0
dj-database-url==0.4.2