WIP: Affiche un warning si trop d'alcool consommé #727

Draft
lstephan wants to merge 4 commits from Aufinal/alcoolémie into master
Showing only changes of commit 55f22f2250 - Show all commits

View file

@ -922,8 +922,8 @@ def account_read_json(request, trigramme):
alcohol_density = 0.8
now = timezone.localtime(timezone.now())
# une soirée va de XXh à 06h
if time(18) <= now.time() or now.time() <= time(6):
begin_time = datetime.combine(now.date(), time(18))
if time(21) <= now.time() or now.time() <= time(6):
begin_time = datetime.combine(now.date(), time(21))
# si on est après minuit, il faut retrancher un jour
if now.time() <= time(6):
begin_time -= timedelta(days=1)