Compare commits
6 Commits
8f4ed337aa
...
2be13b6136
Author | SHA1 | Date | |
---|---|---|---|
2be13b6136 | |||
c26db53d79 | |||
7f23f52d25 | |||
9d26f7bccc | |||
df10bb9b2a | |||
11c86c947f |
8
app.py
8
app.py
@ -13,6 +13,7 @@
|
||||
|
||||
# Modules :
|
||||
import datetime as dti
|
||||
import pytz
|
||||
|
||||
from flask import Flask
|
||||
from flask import render_template
|
||||
@ -243,7 +244,7 @@ def free_rooms() :
|
||||
if time_uf_sav != "None" :
|
||||
nofavslink += "time=" + time_uf_sav
|
||||
# Suppression de l'éventuel '&' en trop :
|
||||
if nofavslink[:-1] == "&" :
|
||||
if nofavslink[-1] == "&" :
|
||||
nofavslink = nofavslink[:-1]
|
||||
|
||||
# Tri des salles selon leurs catégories :
|
||||
@ -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,
|
||||
|
@ -90,4 +90,4 @@ class Dept :
|
||||
self.rooms = rooms
|
||||
|
||||
def genlink(self,link):
|
||||
return "https://adecons.unistra.fr/jsp/custom/modules/plannings/anonymous_cal.jsp?resources="+link.strip()+"&projectId=8&calType=ical"
|
||||
return "https://adecons.unistra.fr/jsp/custom/modules/plannings/anonymous_cal.jsp?resources="+link.strip()+"&projectId=5&calType=ical"
|
||||
|
@ -255,7 +255,8 @@ def get_tot_rooms(datet, depts, ignore_list) :
|
||||
rnamelist.append(roomname)
|
||||
|
||||
for rname in rnamelist :
|
||||
if rname not in roomnames :
|
||||
rname = rname.strip()
|
||||
if (rname not in roomnames) and (rname not in ignore_list) :
|
||||
roomnames.append(rname)
|
||||
|
||||
start = datet.replace(hour = 0, minute = 0, second=0) # Par défaut, l'heure de début de disponibilité est aujourd'hui à 00:00
|
||||
|
Loading…
Reference in New Issue
Block a user