drew-dev #19
2
app.py
2
app.py
|
@ -218,7 +218,7 @@ if __name__ == "__main__":
|
|||
print("Healtchecking...", file=sys.stderr)
|
||||
incPretixRead()
|
||||
res = requests.get(join(domain, "healthcheck"), headers=headers)
|
||||
if(res.status_code == 200):
|
||||
if(res.status_code == 200 or SKIP_HEALTHCHECK):
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
|
|
@ -5,6 +5,7 @@ API_TOKEN = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|||
ORGANIZER = 'furizon'
|
||||
EVENT_NAME = 'overlord'
|
||||
HOSTNAME = 'reg.furizon.net'
|
||||
SKIP_HEALTHCHECK = False
|
||||
|
||||
headers = {'Host': HOSTNAME, 'Authorization': f'Token {API_TOKEN}'}
|
||||
domain = "http://urlllllllllllllllllllll/"
|
||||
|
|
2
ext.py
2
ext.py
|
@ -137,7 +137,7 @@ class Order:
|
|||
return self.data[var]
|
||||
|
||||
def set_room_errors (self, to_set):
|
||||
for s in to_set: self.room_errors.append (s)
|
||||
self.room_errors = to_set
|
||||
|
||||
def ans(self, name):
|
||||
for p in self.data['positions']:
|
||||
|
|
|
@ -12,6 +12,12 @@ ROOM_UNCONFIRM_TEXT = {
|
|||
'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"
|
||||
}
|
||||
|
||||
NOSECOUNT = {
|
||||
'filters': {
|
||||
'capacity': "Here are some furs that share your room type and don't have a confirmed room."
|
||||
}
|
||||
}
|
||||
|
||||
LOCALES = {
|
||||
'shuttle_link': {
|
||||
'en': 'Book now',
|
||||
|
|
20
stats.py
20
stats.py
|
@ -1,5 +1,6 @@
|
|||
from sanic.response import html
|
||||
from sanic import Blueprint
|
||||
from sanic import Blueprint, Request
|
||||
from messages import NOSECOUNT
|
||||
from ext import *
|
||||
|
||||
bp = Blueprint("stats", url_prefix="/manage")
|
||||
|
@ -12,13 +13,24 @@ async def sponsor_count(request, order: Order):
|
|||
tpl = request.app.ctx.tpl.get_template('sponsorcount.html')
|
||||
return html(tpl.render(orders=orders, order=order))
|
||||
|
||||
def calc_filter(orders: dict, filter_cmd: str, order: Order) -> tuple[dict, str]:
|
||||
if not filter_cmd or len(filter_cmd) == 0 or not orders or len(orders.keys()) == 0: return
|
||||
if filter_cmd.lower() == "capacity":
|
||||
return {key:value for key,value in orders.items() if (not value.room_confirmed and value.bed_in_room == order.bed_in_room)}, NOSECOUNT['filters'][filter_cmd.lower()]
|
||||
else:
|
||||
return None, None
|
||||
|
||||
@bp.route("/nosecount")
|
||||
async def nose_count(request, order: Order):
|
||||
async def nose_count(request: Request, order: Order):
|
||||
await request.app.ctx.om.update_cache()
|
||||
orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: len(x[1].room_members), reverse=True) if value.status not in ['c', 'e']}
|
||||
|
||||
filtered: dict = None
|
||||
filter_message: str = None
|
||||
for query in request.query_args:
|
||||
if query[0] == "filter" and order:
|
||||
filtered, filter_message = calc_filter(orders, query[1], order) if filter else None
|
||||
tpl = request.app.ctx.tpl.get_template('nosecount.html')
|
||||
return html(tpl.render(orders=orders, order=order))
|
||||
return html(tpl.render(orders=orders, order=order, filtered=filtered, filter_header=filter_message))
|
||||
|
||||
@bp.route("/fursuitcount")
|
||||
async def fursuit_count(request, order: Order):
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
grid-template-rows: repeat(2, 1fr);
|
||||
}
|
||||
</style>
|
||||
<script src="/res/scripts/base.js" defer></script>
|
||||
</head>
|
||||
<body onscroll="onScrollNav()">
|
||||
{% include 'blocks/navbar.html' %}
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
<p><b>Room's type:</b> {{ROOM_TYPE_NAMES[order.bed_in_room]}}.</p>
|
||||
<p class="notice" style="background:#0881c0"><b>Note! </b> Only people with the same room type can be roommates. If you need help, contact the <a href="https://furizon.net/contact/">Furizon's Staff</a>.</p>
|
||||
|
||||
{% if not order.room_confirmed %}
|
||||
<p class="notice" style="background:#0881c0"><b><a href="https://furizon.net/manage/nosecount?filter=capacity">Check here</a> for any fur who share your room type.</p>
|
||||
{% 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) %} #}
|
||||
|
|
|
@ -20,6 +20,24 @@
|
|||
</picture>
|
||||
</header>
|
||||
<p>Welcome to the nosecount page! Here you can see all of the available rooms at the convention, as well as the occupants currently staying in each room. Use this page to find your friends and plan your meet-ups.</p>
|
||||
{% if filtered and order %}
|
||||
{% for person in filtered.values() %}
|
||||
{% if loop.first %}
|
||||
<hr />
|
||||
<p>{{filter_header}}</p>
|
||||
<div class="grid people" style="padding-bottom:1em;">
|
||||
{% endif %}
|
||||
<div style="margin-bottom: 1em;">
|
||||
{% with current=order, order=person, imgSrc='/res/propic/' + (person.ans('propic') or 'default.png'), effects = true, flag = true %}
|
||||
{% include 'blocks/propic.html' %}
|
||||
{% endwith %}
|
||||
|
||||
<h5>{{person.ans('fursona_name')}}</h5>
|
||||
</div>
|
||||
{% if loop.last %}</div>{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% for o in orders.values() if (o.code == o.room_id and o.room_confirmed) %}
|
||||
{% if loop.first %}
|
||||
<hr />
|
||||
|
|
Loading…
Reference in New Issue