Improved room management (now room guests have an additional item too)

This commit is contained in:
Ed 2022-12-19 22:08:59 +01:00
parent 48c8e5df77
commit 9f92c3806b
2 changed files with 12 additions and 1 deletions

3
app.py
View File

@ -16,8 +16,9 @@ app.ext.add_dependency(Order, get_order)
app.ext.add_dependency(Quotas, get_quotas)
from room import bp as room_bp
from propic import bp as propic_bp
app.blueprint([room_bp,])
app.blueprint([room_bp,propic_bp])
@app.exception(exceptions.SanicException)
async def clear_session(request, exception):

10
room.py
View File

@ -265,6 +265,16 @@ 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:
if rm.code == order.code: continue
thing = {
'order': rm.code,
'addon_to': rm.position_positionid,
'item': 42,
'variation': ([None, 21, 22, 23, 24, 25])[len(room_members)]
}
res = await client.post(join(base_url, "orderpositions/"), headers=headers, json=thing)
for rm in room_members:
await rm.send_answers()