From 8a063246297933e856734a94de8e6f79c13854cf Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 5 Sep 2022 12:13:32 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20bulletin=20BUT=20des=20=C3=A9tudiants=20?= =?UTF-8?q?d=C3=A9missionnaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/js/releve-but.js | 16 ++++++++++------ app/templates/but/bulletin.html | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/static/js/releve-but.js b/app/static/js/releve-but.js index f38650bc6..a84e0dac4 100644 --- a/app/static/js/releve-but.js +++ b/app/static/js/releve-but.js @@ -329,16 +329,20 @@ class releveBUT extends HTMLElement { `; /* UE capitalisées */ - if (ue in data.ues_capitalisees) { - output += this.show_ue_capitalisee(ue, data.ues_capitalisees[ue]); - delete data.ues_capitalisees[ue]; + if (data.ues_capitalisees !== undefined) { + if (ue in data.ues_capitalisees) { + output += this.show_ue_capitalisee(ue, data.ues_capitalisees[ue]); + delete data.ues_capitalisees[ue]; + } } } }); /* UE capitalisées seulement (non déjà vues) */ - Object.entries(data.ues_capitalisees).forEach(([ue, ue_cap]) => { - output += this.show_ue_capitalisee(ue, data.ues_capitalisees[ue]); - }); + if (data.ues_capitalisees !== undefined) { + Object.entries(data.ues_capitalisees).forEach(([ue, ue_cap]) => { + output += this.show_ue_capitalisee(ue, data.ues_capitalisees[ue]); + }); + } this.shadow.querySelector(".synthese").innerHTML = output; } diff --git a/app/templates/but/bulletin.html b/app/templates/but/bulletin.html index 8b133ce93..9e95b26ec 100644 --- a/app/templates/but/bulletin.html +++ b/app/templates/but/bulletin.html @@ -31,19 +31,19 @@ display: none; }`; releve.shadowRoot.appendChild(style); - }) - .catch(error => { - let div = document.createElement("div"); - div.innerText = "Une erreur s'est produite lors du transfert des données."; - div.style.fontSize = "24px"; - div.style.color = "#d93030"; - - let releve = document.querySelector("releve-but"); - releve.after(div); - releve.remove(); - - throw 'Fin du script - données invalides'; }); + // .catch(error => { + // let div = document.createElement("div"); + // div.innerText = "Une erreur s'est produite lors du transfert des données."; + // div.style.fontSize = "24px"; + // div.style.color = "#d93030"; + + // let releve = document.querySelector("releve-but"); + // releve.after(div); + // releve.remove(); + + // throw 'Fin du script - données invalides'; + // }); document.querySelector("html").style.scrollBehavior = "smooth"; {% endblock %} \ No newline at end of file