1
0
forked from ScoDoc/ScoDoc

Assiduites : fixes select annee cal + saisie par null

This commit is contained in:
iziram 2023-08-22 16:06:56 +02:00
parent e2b863a5de
commit a04403cd0e
3 changed files with 23 additions and 6 deletions

View File

@ -336,19 +336,21 @@
} }
const defAnnee = {{ annee }} const defAnnee = {{ annee }}
let annees = {{ annees | safe }}
annees = annees.filter((x, i) => annees.indexOf(x) === i)
const etudid = {{ sco.etud.id }}; const etudid = {{ sco.etud.id }};
const nonwork = [{{ nonworkdays | safe }}]; const nonwork = [{{ nonworkdays | safe }}];
window.onload = () => { window.onload = () => {
const select = document.querySelector('#annee'); const select = document.querySelector('#annee');
for (let i = defAnnee + 1; i > defAnnee - 6; i--) { annees.forEach((a) => {
const opt = document.createElement("option"); const opt = document.createElement("option");
opt.value = i + "", opt.value = a + "",
opt.textContent = i + ""; opt.textContent = `${a} - ${a + 1}`;
if (i === defAnnee) { if (a === defAnnee) {
opt.selected = true; opt.selected = true;
} }
select.appendChild(opt) select.appendChild(opt)
} })
setterAnnee(defAnnee) setterAnnee(defAnnee)
}; };

View File

@ -162,7 +162,11 @@
userIdDiv.textContent = `saisi le ${formatDateModal( userIdDiv.textContent = `saisi le ${formatDateModal(
assiduite.entry_date, assiduite.entry_date,
"à" "à"
)} \npar ${assiduite.user_id}`; )}`;
if (assiduite.user_id != null) {
userIdDiv.textContent += `\npar ${assiduite.user_id}`
}
bubble.appendChild(userIdDiv); bubble.appendChild(userIdDiv);
bubble.style.left = `${event.clientX - bubble.offsetWidth / 2}px`; bubble.style.left = `${event.clientX - bubble.offsetWidth / 2}px`;

View File

@ -417,6 +417,16 @@ def calendrier_etud():
], ],
) )
annees: list[int] = sorted(
[ins.formsemestre.date_debut.year for ins in etud.formsemestre_inscriptions],
reverse=True,
)
annees_str: str = "["
for ann in annees:
annees_str += f"{ann},"
annees_str += "]"
return HTMLBuilder( return HTMLBuilder(
header, header,
render_template( render_template(
@ -425,6 +435,7 @@ def calendrier_etud():
annee=scu.annee_scolaire(), annee=scu.annee_scolaire(),
nonworkdays=_non_work_days(), nonworkdays=_non_work_days(),
minitimeline=_mini_timeline(), minitimeline=_mini_timeline(),
annees=annees_str,
), ),
).build() ).build()