1
0
forked from ScoDoc/ScoDoc

sélection du jour de la semaine par défaut

This commit is contained in:
Emmanuel Viennet 2022-04-19 23:52:52 +02:00
parent 41254e06da
commit dd9351ca6e

View File

@ -28,6 +28,7 @@
"""Tableau de bord semestre
"""
import datetime
from flask import current_app
from flask import g
from flask import request
@ -760,8 +761,7 @@ def _make_listes_sem(sem, with_absences=True):
)
formsemestre_id = sem["formsemestre_id"]
# calcule dates 1er jour semaine pour absences
weekday = datetime.datetime.today().weekday()
try:
if with_absences:
first_monday = sco_abs.ddmmyyyy(sem["date_debut"]).prev_monday()
@ -780,8 +780,8 @@ def _make_listes_sem(sem, with_absences=True):
<select name="datedebut" class="noprint">
"""
date = first_monday
for jour in sco_abs.day_names():
form_abs_tmpl += f'<option value="{date}">{jour}s</option>'
for idx, jour in enumerate(sco_abs.day_names()):
form_abs_tmpl += f"""<option value="{date}" {'selected' if idx == weekday else ''}>{jour}s</option>"""
date = date.next_day()
form_abs_tmpl += f"""
</select>