From a33a9198238e41524c3ec7c07b6e7f5e4b7560fa Mon Sep 17 00:00:00 2001 From: Iziram Date: Fri, 17 Nov 2023 10:17:26 +0100 Subject: [PATCH 1/5] Assiduites : bug fix, retour a date invalide --- app/static/js/assiduites.js | 13 ++++++++----- .../assiduites/pages/signal_assiduites_group.j2 | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index 63b78620f6..9e05312b19 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -1,6 +1,5 @@ // <=== CONSTANTS and GLOBALS ===> -const TIMEZONE = "Europe/Paris"; let url; function getUrl() { @@ -630,13 +629,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 }}" From 559fd82e5256fbe3aa71fa8375990986382dc476 Mon Sep 17 00:00:00 2001 From: Iziram Date: Fri, 17 Nov 2023 11:08:47 +0100 Subject: [PATCH 2/5] Assiduites : bug fix _edit_one external data --- app/api/assiduites.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" ) From a9d30def6ba2f62ba6a068e6a1dcc91775f161e1 Mon Sep 17 00:00:00 2001 From: Iziram Date: Fri, 17 Nov 2023 11:36:15 +0100 Subject: [PATCH 3/5] Assiduites : bug fix visu_assi.j2 --- app/templates/assiduites/pages/visu_assi.j2 | 5 +++-- app/views/assiduites.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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/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()), From 4fe4dfe3e1676397be38029b6cdffcf9a30dfb03 Mon Sep 17 00:00:00 2001 From: Iziram Date: Fri, 17 Nov 2023 12:38:36 +0100 Subject: [PATCH 4/5] Assiduites : bugfix module saisie abs hebdo --- app/scodoc/sco_moduleimpl_status.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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""" Date: Fri, 17 Nov 2023 13:50:49 +0100 Subject: [PATCH 5/5] Assiduites: SignalAssiduiteDifferee bug fix --- app/static/js/assiduites.js | 10 ++++++-- app/templates/assiduites/widgets/differee.j2 | 25 +++++++++++--------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index 9e05312b19..fd4892b414 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -191,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); @@ -203,6 +204,8 @@ async function async_get(path, success, errors) { console.error(error); if (errors) errors(error); } + + return response; } /** @@ -233,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", @@ -252,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 ==>> 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) {