[MTELEBURA-24]add filter to avoid reservation during we v2
This commit is contained in:
parent
f62b115e16
commit
ca1dc6c2ba
|
@ -164,6 +164,35 @@ def liste_type_rdv_nombres_personnes(value, arg):
|
||||||
return [x for x in liste["data"] if arg in x["text"]]
|
return [x for x in liste["data"] if arg in x["text"]]
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def stop_monday_for_we(value):
|
||||||
|
"""
|
||||||
|
Empêche de prendre rdv le lundi matin pendant le w-e
|
||||||
|
"""
|
||||||
|
headers = {"Accept": "application/json"}
|
||||||
|
meeting_liste = requests.get(value, headers=headers).json()
|
||||||
|
today = datetime.datetime.today()
|
||||||
|
weekday = today.weekday()
|
||||||
|
if 4 >= weekday >= 0:
|
||||||
|
return meeting_liste
|
||||||
|
|
||||||
|
if 5 <= weekday <= 6:
|
||||||
|
next_day = today
|
||||||
|
while weekday != 0:
|
||||||
|
next_day = next_day + datetime.timedelta(days=1)
|
||||||
|
weekday = next_day.weekday()
|
||||||
|
|
||||||
|
monday = next_day.replace(hour=12, minute=0, second=0, microsecond=0)
|
||||||
|
return [
|
||||||
|
x
|
||||||
|
for x in meeting_liste
|
||||||
|
if datetime.datetime.strptime(x["datetime"], "%Y-%m-%d %H:%M:%S") < monday
|
||||||
|
]
|
||||||
|
|
||||||
|
if weekday > 6 or weekday < 0:
|
||||||
|
raise Exception("Index OutOf weekday")
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def calcul_total_abonnement_stationnement(fields_bloc):
|
def calcul_total_abonnement_stationnement(fields_bloc):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue