From c735144dca13d8f412663355049ca10bdf116229 Mon Sep 17 00:00:00 2001 From: Ed Date: Wed, 20 Sep 2023 20:15:48 +0200 Subject: [PATCH] Added option to define daily tickets, added fixes for daily tickets --- app.py | 1 + ext.py | 5 +++-- room.py | 4 ++-- tpl/blocks/room.html | 1 + tpl/nosecount.html | 2 +- tpl/welcome.html | 10 +++++----- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index 8bb944b..88e663a 100644 --- a/app.py +++ b/app.py @@ -60,6 +60,7 @@ async def main_start(*_): app.ctx.tpl = Environment(loader=FileSystemLoader("tpl"), autoescape=True) app.ctx.tpl.globals.update(time=time) app.ctx.tpl.globals.update(PROPIC_DEADLINE=PROPIC_DEADLINE) + app.ctx.tpl.globals.update(ITEM_IDS=ITEM_IDS) app.ctx.tpl.globals.update(int=int) app.ctx.tpl.globals.update(len=len) diff --git a/ext.py b/ext.py index 9f87c21..e5abb83 100644 --- a/ext.py +++ b/ext.py @@ -39,9 +39,10 @@ class Order: self.country = idata['country'] for p in self.data['positions']: - if p['item'] in ITEM_IDS['ticket']: + if p['item'] in (ITEM_IDS['ticket'] + ITEM_IDS['daily']): self.position_id = p['id'] self.position_positionid = p['positionid'] + self.position_positiontypeid = p['item'] self.answers = p['answers'] self.barcode = p['secret'] self.checked_in = bool(p['checkins']) @@ -176,7 +177,7 @@ class Quotas: def get_left(self, capacity): for quota in self.data['results']: - if quota['id'] == ROOM_MAP[capacity]: + if quota['id'] == ROOM_QUOTA_ID[capacity]: return quota['available_number'] return 0 diff --git a/room.py b/room.py index 71c327f..32c9a63 100644 --- a/room.py +++ b/room.py @@ -289,7 +289,7 @@ async def confirm_room(request, order: Order, quotas: Quotas): if res.status_code != 201: raise exceptions.BadRequest("Something has gone wrong! Please contact support immediately") - for rm in room_members: + '''for rm in room_members: if rm.code == order.code: continue thing = { 'order': rm.code, @@ -297,7 +297,7 @@ async def confirm_room(request, order: Order, quotas: Quotas): 'item': ITEM_IDS['room'], 'variation': ROOM_MAP[len(room_members)] } - res = await client.post(join(base_url, "orderpositions/"), headers=headers, json=thing) + res = await client.post(join(base_url, "orderpositions/"), headers=headers, json=thing) ''' for rm in room_members: await rm.send_answers() diff --git a/tpl/blocks/room.html b/tpl/blocks/room.html index 7d8d9e9..0b8f05f 100644 --- a/tpl/blocks/room.html +++ b/tpl/blocks/room.html @@ -3,6 +3,7 @@

Your room {% if room_members %}- {{room_members[0].ans('room_name')}}{% endif %}

{# Show alert if room owner has wrong people inside #} + {% if room_members and quota.get_left(len(room_members)) == 0 and (not order.room_confirmed) %}

⚠️ Your room contains {{len(room_members)}} people inside, but sadly there are no more {{[None,'single','double','triple','quadruple','quintuple'][len(room_members)]}} rooms. You need to add or remove people until you reach the size of an available room if you want to confirm it.

{% endif %} diff --git a/tpl/nosecount.html b/tpl/nosecount.html index 55b64c2..f5826b7 100644 --- a/tpl/nosecount.html +++ b/tpl/nosecount.html @@ -35,7 +35,7 @@

Unconfirmed rooms

These unconfirmed rooms are still being organized and may be subject to change. These rooms may also have openings for additional roommates. If you are interested in sharing a room, you can use this page to find potential roommates

{% endif %} -

{% if o.room_confirmed %}🔒{% endif %}{{o.room_name}}

+

{{o.room_name}}

{% for m in o.room_members %} {% if m in orders %} diff --git a/tpl/welcome.html b/tpl/welcome.html index 68c8f4d..1019f16 100644 --- a/tpl/welcome.html +++ b/tpl/welcome.html @@ -12,7 +12,7 @@

From here, you can easily manage all aspects of your booking, including composing your hotel room, designing your badge, and updating your payment information. Simply use the buttons below to navigate between the different sections.

Buttons marked with ⚠️ require your attention

-

If you have any questions or issues while using this page, please don't hesitate to contact us for assistance. We look forward to seeing you at Furizon Beyond!

+

If you have any questions or issues while using this page, please don't hesitate to contact us for assistance. We look forward to seeing you at Furizon Riverside!


Useful information

@@ -30,7 +30,7 @@
When (check-in)? - {{('29' if order.has_early else '30')|safe}} May → {{('4' if order.has_late else '3')|safe}} June 2023 + {{('12' if order.has_early else '13')|safe}} October → {{('16' if order.has_late else '15')|safe}} October 2023 {% if order.has_early %} EARLY {% endif %} @@ -61,7 +61,9 @@

Manage your booking

{% include 'blocks/payment.html' %} - {% include 'blocks/room.html' %} + {% if order.position_positiontypeid not in ITEM_IDS['daily'] %} + {% include 'blocks/room.html' %} + {% endif %} {% include 'blocks/badge.html' %}
@@ -76,8 +78,6 @@ Nose count
- {% include 'blocks/karaoke.html' %} -
Carpooling

We want to make it easy for attendees to find and offer carpooling options. If you have seats available in your car, you can use our carpooling system to offer rides to other attendees. And if you need a ride, you can search for leftover seats in cars that are already heading to the convention. This is a great way to save money on gas and reduce your carbon footprint, while also getting to know other attendees and making new friends.