[WIP1] Localization, Shuttle bus section
This commit is contained in:
parent
a2b9f7a7c1
commit
1da054c9ff
2
app.py
2
app.py
|
@ -10,6 +10,7 @@ from aztec_code_generator import AztecCode
|
||||||
from propic import resetDefaultPropic
|
from propic import resetDefaultPropic
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from asyncio import Queue
|
from asyncio import Queue
|
||||||
|
from messages import LOCALES
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from sanic.log import logger
|
from sanic.log import logger
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ async def main_start(*_):
|
||||||
app.ctx.tpl = Environment(loader=FileSystemLoader("tpl"), autoescape=True)
|
app.ctx.tpl = Environment(loader=FileSystemLoader("tpl"), autoescape=True)
|
||||||
app.ctx.tpl.globals.update(time=time)
|
app.ctx.tpl.globals.update(time=time)
|
||||||
app.ctx.tpl.globals.update(PROPIC_DEADLINE=PROPIC_DEADLINE)
|
app.ctx.tpl.globals.update(PROPIC_DEADLINE=PROPIC_DEADLINE)
|
||||||
|
app.ctx.tpl.globals.update(LOCALES=LOCALES)
|
||||||
app.ctx.tpl.globals.update(ITEMS_ID_MAP=ITEMS_ID_MAP)
|
app.ctx.tpl.globals.update(ITEMS_ID_MAP=ITEMS_ID_MAP)
|
||||||
app.ctx.tpl.globals.update(ITEM_VARIATIONS_MAP=ITEM_VARIATIONS_MAP)
|
app.ctx.tpl.globals.update(ITEM_VARIATIONS_MAP=ITEM_VARIATIONS_MAP)
|
||||||
app.ctx.tpl.globals.update(ROOM_TYPE_NAMES=ROOM_TYPE_NAMES)
|
app.ctx.tpl.globals.update(ROOM_TYPE_NAMES=ROOM_TYPE_NAMES)
|
||||||
|
|
|
@ -33,6 +33,11 @@ DEV_MODE = True
|
||||||
ACCESS_LOG = True
|
ACCESS_LOG = True
|
||||||
EXTRA_PRINTS = True
|
EXTRA_PRINTS = True
|
||||||
|
|
||||||
|
# Additional configured locales.
|
||||||
|
# If an order has a country that's not listed here,
|
||||||
|
# Will default to an english preference.
|
||||||
|
AVAILABLE_LOCALES = ['it',]
|
||||||
|
|
||||||
# Metadata property for item-id mapping
|
# Metadata property for item-id mapping
|
||||||
METADATA_NAME = "item_name"
|
METADATA_NAME = "item_name"
|
||||||
# Metadata property for internal category mapping (not related to pretix's category)
|
# Metadata property for internal category mapping (not related to pretix's category)
|
||||||
|
|
7
ext.py
7
ext.py
|
@ -131,6 +131,7 @@ class Order:
|
||||||
self.actual_room = self.ans('actual_room')
|
self.actual_room = self.ans('actual_room')
|
||||||
self.staff_role = self.ans('staff_role')
|
self.staff_role = self.ans('staff_role')
|
||||||
self.telegram_username = self.ans('telegram_username').strip('@') if self.ans('telegram_username') else None
|
self.telegram_username = self.ans('telegram_username').strip('@') if self.ans('telegram_username') else None
|
||||||
|
self.shuttle_bus = self.ans('shuttle_bus')
|
||||||
def __getitem__(self, var):
|
def __getitem__(self, var):
|
||||||
return self.data[var]
|
return self.data[var]
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ class Order:
|
||||||
if res.status_code != 200:
|
if res.status_code != 200:
|
||||||
for ans, err in zip(self.answers, res.json()['answers']):
|
for ans, err in zip(self.answers, res.json()['answers']):
|
||||||
if err:
|
if err:
|
||||||
logger.error ('[ANSWERS SENDING] ERROR ON', ans, err)
|
logger.error ('[ANSWERS SENDING] ERROR ON %s %s', ans, err)
|
||||||
|
|
||||||
raise exceptions.ServerError('There has been an error while updating this answers.')
|
raise exceptions.ServerError('There has been an error while updating this answers.')
|
||||||
|
|
||||||
|
@ -226,7 +227,9 @@ class Order:
|
||||||
self.pending_update = False
|
self.pending_update = False
|
||||||
self.time = -1
|
self.time = -1
|
||||||
self.loadAns()
|
self.loadAns()
|
||||||
|
|
||||||
|
def get_language(self):
|
||||||
|
return self.country.lower() if self.country.lower() in AVAILABLE_LOCALES else 'en'
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Quotas:
|
class Quotas:
|
||||||
|
|
11
messages.py
11
messages.py
|
@ -10,4 +10,15 @@ ROOM_UNCONFIRM_TITLE = "Your room got unconfirmed"
|
||||||
ROOM_UNCONFIRM_TEXT = {
|
ROOM_UNCONFIRM_TEXT = {
|
||||||
'html': "Hello <b>{0}</b><br>We had to <b>unconfirm</b> your room <i>'{1}'</i> due to the following issues:<br></p>{2}<br><p>Please contact your room's owner or contact our support for further informations at <a href=\"https://furizon.net/contact/\"> https://furizon.net/contact/</a>.<br>Thank you.<br><br><a class=\"link\" style=\"background-color: #1095c1; color: #fff;\" href=\"https://reg.furizon.net/manage/welcome\">Manage booking</a>",
|
'html': "Hello <b>{0}</b><br>We had to <b>unconfirm</b> your room <i>'{1}'</i> due to the following issues:<br></p>{2}<br><p>Please contact your room's owner or contact our support for further informations at <a href=\"https://furizon.net/contact/\"> https://furizon.net/contact/</a>.<br>Thank you.<br><br><a class=\"link\" style=\"background-color: #1095c1; color: #fff;\" href=\"https://reg.furizon.net/manage/welcome\">Manage booking</a>",
|
||||||
'plain': "Hello {0}\nWe had to unconfirm your room '{1}' due to the following issues:\n{2}\nPlease contact your room's owner or contact our support for further informations at https://furizon.net/contact/.\nThank you\n\nTo manage your booking: https://reg.furizon.net/manage/welcome"
|
'plain': "Hello {0}\nWe had to unconfirm your room '{1}' due to the following issues:\n{2}\nPlease contact your room's owner or contact our support for further informations at https://furizon.net/contact/.\nThank you\n\nTo manage your booking: https://reg.furizon.net/manage/welcome"
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCALES = {
|
||||||
|
'shuttle_link': {
|
||||||
|
'en': 'Book now',
|
||||||
|
'it': 'Prenota ora'
|
||||||
|
},
|
||||||
|
'shuttle_link_url': {
|
||||||
|
'en': 'https://visitfiemme.regiondo.com/furizon?_ga=2.129644046.307369854.1705325023-235291123.1705325023',
|
||||||
|
'it': 'https://experience.visitfiemme.it/furizon'
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,11H6V6H18M16.5,17A1.5,1.5 0 0,1 15,15.5A1.5,1.5 0 0,1 16.5,14A1.5,1.5 0 0,1 18,15.5A1.5,1.5 0 0,1 16.5,17M7.5,17A1.5,1.5 0 0,1 6,15.5A1.5,1.5 0 0,1 7.5,14A1.5,1.5 0 0,1 9,15.5A1.5,1.5 0 0,1 7.5,17M4,16C4,16.88 4.39,17.67 5,18.22V20A1,1 0 0,0 6,21H7A1,1 0 0,0 8,20V19H16V20A1,1 0 0,0 17,21H18A1,1 0 0,0 19,20V18.22C19.61,17.67 20,16.88 20,16V6C20,2.5 16.42,2 12,2C7.58,2 4,2.5 4,6V16Z" /></svg>
|
After Width: | Height: | Size: 466 B |
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
{% set locale = order.get_language() %}
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<header>
|
<header>
|
||||||
<picture>
|
<picture>
|
||||||
|
@ -67,6 +68,15 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% if order.shuttle_bus %}
|
||||||
|
<tr>
|
||||||
|
<th>Shuttle</th>
|
||||||
|
<td>
|
||||||
|
<img src="/res/icons/bus.svg" class="icon" />
|
||||||
|
{{order.shuttle_bus}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>Manage your booking</h2>
|
<h2>Manage your booking</h2>
|
||||||
|
@ -76,6 +86,12 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include 'blocks/badge.html' %}
|
{% include 'blocks/badge.html' %}
|
||||||
|
|
||||||
|
<details id="shuttle">
|
||||||
|
<summary role="button"><img src="/res/icons/bus.svg" class="icon" />Shuttle</summary>
|
||||||
|
<p>This year we teamed up with VisitFiemme to take our guests to the convention.</p>
|
||||||
|
<p style="text-align:right;"><a href="{{LOCALES['shuttle_link_url'][locale]}}" target="_blank" role="button">Book now</a></p>
|
||||||
|
</details>
|
||||||
|
|
||||||
<details id="barcard">
|
<details id="barcard">
|
||||||
<summary role="button"><img src="/res/icons/bar.svg" class="icon" />Barcard</summary>
|
<summary role="button"><img src="/res/icons/bar.svg" class="icon" />Barcard</summary>
|
||||||
<p>This year's badges will be NFC-enabled and serve as a digital barcard, allowing you to load 'drinks' onto your badge and use it to purchase beverages at the bar without the need for physical cash or the risk of losing a paper barcard. The barcard system will be enabled closer to the convention, so you will have the opportunity to load your badge in advance and enjoy a convenient, cashless experience at the event. Keep an eye out for updates on when the system will be live and available for use.</p>
|
<p>This year's badges will be NFC-enabled and serve as a digital barcard, allowing you to load 'drinks' onto your badge and use it to purchase beverages at the bar without the need for physical cash or the risk of losing a paper barcard. The barcard system will be enabled closer to the convention, so you will have the opportunity to load your badge in advance and enjoy a convenient, cashless experience at the event. Keep an eye out for updates on when the system will be live and available for use.</p>
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -170,7 +170,7 @@ async def validate_rooms(request, rooms, om):
|
||||||
logger.info('[ROOM VALIDATION] Every room passed the check.')
|
logger.info('[ROOM VALIDATION] Every room passed the check.')
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.warning(f'[ROOM VALIDATION] Room validation failed for orders: ', list(map(lambda rf: rf[0].code, failed_rooms)))
|
logger.warning(f'[ROOM VALIDATION] Room validation failed for orders: %s', list(map(lambda rf: rf[0].code, failed_rooms)))
|
||||||
|
|
||||||
# Get confirmed rooms that fail validation
|
# Get confirmed rooms that fail validation
|
||||||
failed_confirmed_rooms = list(filter(lambda fr: (fr[0].room_confirmed == True), failed_rooms))
|
failed_confirmed_rooms = list(filter(lambda fr: (fr[0].room_confirmed == True), failed_rooms))
|
||||||
|
|
Loading…
Reference in New Issue