Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/camps/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ def teardown_days(self):

# convenience properties to access Camp-related stuff easily from the Camp object

@property
def year(self) -> int:
"""Return the year of this camp."""
return self.camp.lower.year

@property
def event_types(self):
"""Return all event types with at least one event in this camp."""
Expand Down
7 changes: 7 additions & 0 deletions src/camps/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,10 @@ def test_participant_count(self) -> None:
child_one_day.save()

assert self.camp.participant_count == 4

def test_year_of_camp(self) -> None:
"""Test the property `year` return current year of camp."""
expected = self.camp.camp.lower.year

assert self.camp.year == expected

2 changes: 1 addition & 1 deletion src/program/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ def get(self, *args, **kwargs):
E.version("BornHack Frab XML Generator v2.0"),
E.conference(
E.title(self.camp.title),
E.acronym(str(self.camp.camp.lower.year)),
E.acronym(str(self.camp.year)),
E.start(self.camp.camp.lower.date().isoformat()),
E.end(self.camp.camp.upper.date().isoformat()),
E.days(len(self.camp.get_days("camp"))),
Expand Down
20 changes: 10 additions & 10 deletions src/shop/management/commands/copy_tickets_from_camp_to_camp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import logging

from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.utils import timezone
from datetime import timedelta

from camps.models import Camp
from tickets.models import TicketType
from shop.models import Product, SubProductRelation
from shop.models import Product
from shop.models import SubProductRelation

logger = logging.getLogger(f"bornhack.{__name__}")

Expand Down Expand Up @@ -56,16 +56,16 @@ def handle(self, *args, **options) -> None:
print(f"Created new TicketType {newtt}")
for product in tt.product_set.filter(sub_products__isnull=True):
newprod, created = Product.objects.get_or_create(
name=product.name.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
name=product.name.replace(str(fromcamp.year), str(tocamp.year)),
ticket_type=newtt,
slug=product.slug.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
slug=product.slug.replace(str(fromcamp.year), str(tocamp.year)),
defaults={
"price": product.price,
"category": product.category,
"description": product.description.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
"description": product.description.replace(str(fromcamp.year), str(tocamp.year)),
"available_in": (timezone.now(), tocamp.camp.upper + timedelta(days=30)),
"cost": product.cost,
"comment": product.comment.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
"comment": product.comment.replace(str(fromcamp.year), str(tocamp.year)),
}
)
if created:
Expand All @@ -77,15 +77,15 @@ def handle(self, *args, **options) -> None:
print(product)
# create bundle product
newprod, created = Product.objects.get_or_create(
name=product.name.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
slug=product.slug.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
name=product.name.replace(str(fromcamp.year), str(tocamp.year)),
slug=product.slug.replace(str(fromcamp.year), str(tocamp.year)),
defaults={
"price": product.price,
"category": product.category,
"description": product.description.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
"description": product.description.replace(str(fromcamp.year), str(tocamp.year)),
"available_in": (timezone.now(), tocamp.camp.upper + timedelta(days=30)),
"cost": product.cost,
"comment": product.comment.replace(str(fromcamp.camp.lower.year), str(tocamp.camp.lower.year)),
"comment": product.comment.replace(str(fromcamp.year), str(tocamp.year)),
}
)
for spr in product.sub_product_relations.all():
Expand Down
2 changes: 1 addition & 1 deletion src/tickets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get(self, request, *args, **kwargs):
ticket = self.get_object(*args, **kwargs)
response = HttpResponse(content_type="application/pdf")
response["Content-Disposition"] = (
f'attachment; filename="BornHack_{ticket.ticket_type.camp.camp.lower.year}_{ticket.shortname}_ticket_{ticket.pk}.pdf"'
f'attachment; filename="BornHack_{ticket.ticket_type.camp.year}_{ticket.shortname}_ticket_{ticket.pk}.pdf"'
)
response.write(ticket.generate_pdf().getvalue())
return response
Expand Down
4 changes: 2 additions & 2 deletions src/tokens/templates/token_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ <h3 class="mb-4">How to play?</h3>
<p>Token examples:</p>
<p>
<ul>
<li><code>BornHack{{ camp.camp.lower.year }}</code></li>
<li><code>BornHack{{ camp.year }}</code></li>
<li><code>cm9sbGllczIwMjR5b3V3aW4K</code></li>
<li><code>Ly5caCRLKRHrpiF6SQwe9geUKAxSsLQE</code></li>
</ul>
</p>
<p>Tokens are hidden or in plain sight physically or virtually on the BornHack venue, online and offline.</p>
<p class="mb-0">Submit the tokens you find in the field below. You can start with this one: <b>HelloTokenHunters{{ camp.camp.lower.year }}</b></p>
<p class="mb-0">Submit the tokens you find in the field below. You can start with this one: <b>HelloTokenHunters{{ camp.year }}</b></p>
</div>
<div class="col-12 my-4">
<form action="{% url 'tokens:submit' camp_slug=camp.slug %}" method="post">
Expand Down
Loading
Loading