diff --git a/app/api/assiduites.py b/app/api/assiduites.py index ae0993a765..1abb6479df 100644 --- a/app/api/assiduites.py +++ b/app/api/assiduites.py @@ -1014,7 +1014,7 @@ def _edit_one(assiduite_unique: Assiduite, data: dict) -> tuple[int, str]: else assiduite_unique.external_data ) - if force and not external_data.get("module", False): + if force and not (external_data is not None and external_data.get("module", False) != ""): errors.append( "param 'moduleimpl_id' : le moduleimpl_id ne peut pas être nul" ) diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index b6e3581685..b90382a462 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -331,15 +331,16 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None): >Saisie Absences journée """ ) - + year, week, day = datetime.date.today().isocalendar() + semaine: str = f"{year}-W{week}" H.append( f""" -const TIMEZONE = "Europe/Paris"; let url; function getUrl() { @@ -192,8 +191,9 @@ function sync_get(path, success, errors) { */ async function async_get(path, success, errors) { console.log("async_get " + path); + let response; try { - const response = await fetch(path); + response = await fetch(path); if (response.ok) { const data = await response.json(); success(data); @@ -204,6 +204,8 @@ async function async_get(path, success, errors) { console.error(error); if (errors) errors(error); } + + return response; } /** @@ -234,8 +236,9 @@ function sync_post(path, data, success, errors) { */ async function async_post(path, data, success, errors) { console.log("async_post " + path); + let response; try { - const response = await fetch(path, { + response = await fetch(path, { method: "POST", headers: { "Content-Type": "application/json", @@ -253,6 +256,8 @@ async function async_post(path, data, success, errors) { console.error(error); if (errors) errors(error); } + + return response; } // <<== Gestion des actions de masse ==>> @@ -630,13 +635,17 @@ function updateDate() { ) ); openAlertModal("Attention", div, "", "#eec660"); - $(dateInput).datepicker( - "setDate", - Date.toFRA(lastWorkDay.toIsoUtcString().split("T")[0]) - ); + const date_fra = Date.toFRA(lastWorkDay.toIsoUtcString().split("T")[0]); + + $(dateInput).datepicker("setDate", date_fra); + dateInput.value = date_fra; + date = lastWorkDay; dateStr = formatDate(lastWorkDay).capitalize(); } + + console.warn(dateStr, date, date.toIsoUtcString()); + document.querySelector("#datestr").textContent = dateStr; return true; } diff --git a/app/templates/assiduites/pages/signal_assiduites_group.j2 b/app/templates/assiduites/pages/signal_assiduites_group.j2 index 6e761c3a10..15fd6a48f7 100644 --- a/app/templates/assiduites/pages/signal_assiduites_group.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_group.j2 @@ -89,8 +89,8 @@ const readOnly = {{ readonly }}; - updateDate(); setupDate(); + updateDate(); setupTimeLine(); window.forceModule = "{{ forcer_module }}" diff --git a/app/templates/assiduites/pages/visu_assi.j2 b/app/templates/assiduites/pages/visu_assi.j2 index 71585f8d73..d2679ad7cf 100644 --- a/app/templates/assiduites/pages/visu_assi.j2 +++ b/app/templates/assiduites/pages/visu_assi.j2 @@ -3,6 +3,7 @@ {% block scripts %} {{ super() }} + {% endblock %} {% block app_content %} @@ -31,8 +32,8 @@ const group_ids = "{{group_ids}}"; function stats() { - const deb = document.querySelector('#stats_date_debut').value; - const fin = document.querySelector('#stats_date_fin').value; + const deb = Date.fromFRA(document.querySelector('#stats_date_debut').value); + const fin = Date.fromFRA(document.querySelector('#stats_date_fin').value); location.href = `VisualisationAssiduitesGroupe?group_ids=${group_ids}&date_debut=${deb}&date_fin=${fin}`; } diff --git a/app/templates/assiduites/widgets/differee.j2 b/app/templates/assiduites/widgets/differee.j2 index 1c8b2a0f60..65cfb35158 100644 --- a/app/templates/assiduites/widgets/differee.j2 +++ b/app/templates/assiduites/widgets/differee.j2 @@ -954,24 +954,27 @@ editList.push(edit); }) - - $.when( - asyncCreateAssiduiteGroup(createList, (data) => { - + const values = { "create": {}, "edit": {} }; + Promise.all( + [asyncCreateAssiduiteGroup(createList, (data) => { + values.create = data; }), asyncEditAssiduiteGroup(editList, (data) => { + values.edit = data; - }) - ).done((c, e) => { + })] + ).then(() => { + const c = values.create; + const e = values.edit; let error; - Object.keys(c[0].success).forEach((k) => { + Object.keys(c.success).forEach((k) => { const assiduite = createList[Number.parseInt(k)]; - assiduite["assiduite_id"] = c[0].success[k].message.assiduite_id; + assiduite["assiduite_id"] = c.success[k].message.assiduite_id; assiduites[assiduite.etudid].push(assiduite); }) - if (c[0].errors.length > 0) { - error = c[0].errors[Object.keys(c[0].errors)[0]]; + if (c.errors.length > 0) { + error = c.errors[Object.keys(c.errors)[0]]; if (error.message.indexOf("Module") != -1) { const html = `

Aucun module n'a été spécifié (préférence du semestre concerné)

@@ -982,7 +985,7 @@ toCreate.length = 0 } } - Object.keys(e[0].success).forEach((k) => { + Object.keys(e.success).forEach((k) => { const { etudid, assiduite_id, moduleimpl_id, etat } = editList[Number.parseInt(k)] assiduites[etudid].map((a) => { if (a.assiduite_id == assiduite_id) { diff --git a/app/views/assiduites.py b/app/views/assiduites.py index ce7bfdf476..9d63724855 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -1019,7 +1019,7 @@ def visu_assi_group(): short=False, ), date_debut=_dateiso_to_datefr(dates["debut"]), - date_fin=_dateiso_to_datefr(dates["debut"]), + date_fin=_dateiso_to_datefr(dates["fin"]), gr_tit=gr_tit, group_ids=request.args.get("group_ids", None), sco=ScoData(formsemestre=groups_infos.get_formsemestre()),