Skip to content

Instantly share code, notes, and snippets.

@stef
Last active August 25, 2021 08:49
Show Gist options
  • Save stef/d28d2f6bd38016563260 to your computer and use it in GitHub Desktop.
Save stef/d28d2f6bd38016563260 to your computer and use it in GitHub Desktop.
camp++ 2021 cost calculator
#!/usr/bin/env python3
import sys
regs = {
#"name": {'days': '4', 'comment': '', 'paid': 0, 'currency': "huf"},
}
person=None
if len(sys.argv)==2: person = regs.get(sys.argv[1])
total_days = sum(x['days'] for x in regs.values())
camp_days = sum(x['days'] - 1 if x['days'] < 5 else 3 for x in regs.values()) # this is for the sum of camp fee, which is less than person_days
# taken from https://www.xe.com/currencyconverter/convert/?Amount=1&From=EUR&To=HUF
EUR = 347.65 # HUF mid-market rates @ 2021-08-25 08:45 UTC
VAT = 1.27
days = 4
# general costs (everything is in HUF)
power = 0 # 39000 * VAT # power transmission to the campsite
shower = 340000 * VAT # (260000+7000) * VAT # shower container rent + final cleaning of shower container
transport = 200 * EUR # transport between hsbp and campsite
# per person
camp = 1266 * VAT # /day permit to camp on the grounds (max 3 days)
#room_klapka = 60000 * VAT # for 1 day
#room_guyon = 40000 * VAT # for 4 days
rooms = 0 #room_klapka + room_guyon
# we paid this upfront
upfront = shower
# we have to pay this after the event to the Fortress
fix = power + rooms + transport
food = sum(
# bills in HUF
(0,
# bills in EUR
sum((0,
)) * EUR)
)
contributed = food
# if all goes well, after the event, we have exactly
totalcosts = upfront + fix + contributed + (camp * (camp_days))
print('total days', total_days, 'camp days', camp_days, 'total costs', totalcosts, 'HUF |', totalcosts / EUR, 'EUR')
print("camp days", camp_days, (camp * (camp_days)))
# which will be paid to the Fortress for their services.
perperson = (upfront + fix + contributed) / float(total_days)
# this is the total cost of infrastructure / person
def price(person):
person_days = person.get('days',0)
# the camping fee
extra = (camp * (person_days - 1 if person_days < 4 else 3))
# each person has an additional cost for the campsite
ticketprice = perperson * person_days + extra
return ticketprice
valid = sum(price(p) for p in regs.values())
print("valid", valid)
if person:
ticketprice = price(person)
print('ticket price', ticketprice, 'HUF', ticketprice / EUR, 'EUR')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment