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

View file

@ -1,3 +1,4 @@
from decimal import Decimal
import os import os
import sys import sys
@ -8,6 +9,8 @@ import saml2.saml
from datetime import date, datetime from datetime import date, datetime
from dataclasses import dataclass
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__)) PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
DJANGO_ROOT = os.path.abspath(os.path.dirname(django.__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) PENGUIN_DINNER_TICKET_DATE = date(2020, 1, 15)
SPEAKER_DINNER_TICKET_DATE = date(2020, 1, 14) SPEAKER_DINNER_TICKET_DATE = date(2020, 1, 14)
PDNS_TICKET_DATE = date(2020, 1, 16) 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 coverage==4.0.3
cryptography==2.3 cryptography==2.3
cssselect2==0.2.1 cssselect2==0.2.1
dataclasses==0.6
decorator==4.3.0 decorator==4.3.0
defusedxml==0.5.0 defusedxml==0.5.0
dj-database-url==0.4.2 dj-database-url==0.4.2