@@ -25,90 +25,90 @@ def donation_income(context, invoice):
fsa_rate = Decimal("0.85")
rbi_full_ticket = Decimal("68.00")
rbi_early_bird_discount = Decimal("-21.35")
rbi = []
for line in invoice.lineitem_set.all():
if line.product.category.name == "Ticket":
if line.product.name.startswith("Unaffiliated Individual"):
# Includes full price & discounts
rbi.append(line.total_price * fsa_rate)
else:
if line.total_price > 0:
rbi.append(rbi_full_ticket)
elif line.total_price < 0:
rbi.append(rbi_early_bird_discount)
elif line.product.category.name == "T-Shirt":
donation = max(Decimal('0'), (invoice.value - sum(rbi)))
return donation.quantize(Decimal('.01'))
# TODO: include van/de/van der/de la/etc etc etc
@register.simple_tag
def name_split(name, split_characters=None):
tokens = name.split()
if split_characters is None or len(name) > split_characters:
even_split = int((len(tokens) + 1) / 2) # Round up.
even_split = len(tokens)
return {
"first" : " ".join(tokens[:even_split]),
"last" : " ".join(tokens[even_split:]),
}
def company_split(name):
f = name_split(name, 18)
return f
@register.simple_tag(takes_context=True)
def special(context, user):
organiser = user.groups.filter(name='Conference organisers').exists()
speaker = if user.speaker_profile and user.speaker_profile.presentations.count() != 0
speaker = if hasattr(user, "speaker_profile") and user.speaker_profile.presentations.count() != 0
volunteer = "Volunteer" in ticket_type(context)
if organiser:
return "Organizer"
elif speaker:
return "Speaker"
elif volunteer:
return "Staff"
return ""
CLEARED = set([
"BeeWare Project",
"Project Jupyter",
"PSF Packaging WG / PyCon 2018 Chair",
"PyCon Ukraine",
"PyLadies PDX",
"Recovered Silver",
"Twisted",
"@vmbrasseur",
])
def affiliation(ticket, user):
aff = user.attendee.attendeeprofilebase.attendeeprofile.company
if "Individual" not in ticket or "Sponsor" in ticket:
return aff
elif ticket == "Individual Supporter" and aff in CLEARED:
def ticket_type(context):
items = registrasion_tags.items_purchased(context)
for item in items:
if item.product.category.name == "Ticket":
return item.product.name