Les salles prochainement disponibles sont triées par ordre chronologique

master
theo@manjaro 2022-09-02 11:39:38 +02:00
parent 7f23f52d25
commit c26db53d79
1 changed files with 6 additions and 0 deletions

6
app.py
View File

@ -13,6 +13,7 @@
# Modules :
import datetime as dti
import pytz
from flask import Flask
from flask import render_template
@ -255,6 +256,11 @@ def free_rooms() :
for r in free_rooms:
[[soon_rooms,final_rooms],[favs_soon_rooms,favs_free_rooms]][r.id in favs_ids][r.is_free].append(r)
# Tri des salles bientôt disponibles en fonction du temps d'attente
sortfunc = lambda x: x.start-date.astimezone(pytz.timezone('Europe/Paris'))
soon_rooms.sort(key=sortfunc)
favs_soon_rooms.sort(key=sortfunc)
context = {"favs_free_rooms":favs_free_rooms, "favs_soon_rooms":favs_soon_rooms,
"free_rooms":final_rooms, "soon_rooms":soon_rooms, "frooms_disp":frooms_disp,
"depts_str":depts_str, "dident_list":dident_list, "date_str":date_str,