From 5f0ac236d70d69141429e487c476c47dd14c799f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 31 May 2023 12:25:40 +0200 Subject: [PATCH 1/2] =?UTF-8?q?More=20debug=20info=20(save=5Fnote=20:=20my?= =?UTF-8?q?st=C3=A8re)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/notes.py | 2 +- app/scodoc/sco_saisie_notes.py | 6 +++++- app/static/js/saisie_notes.js | 1 + sco_version.py | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/notes.py b/app/models/notes.py index 0f82e286..04ceb1c0 100644 --- a/app/models/notes.py +++ b/app/models/notes.py @@ -56,7 +56,7 @@ class NotesNotes(db.Model): "pour debug" from app.models.evaluations import Evaluation - return f"""<{self.__class__.__name__} {self.id} v={self.value} {self.date.isoformat() + return f"""<{self.__class__.__name__} {self.id} etudid={self.etudid} v={self.value} {self.date.isoformat() } {Evaluation.query.get(self.evaluation_id) if self.evaluation_id else "X" }>""" diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 6c470777..594ee20b 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -583,8 +583,12 @@ def notes_add( existing_note = NotesNotes.query.filter_by( evaluation_id=evaluation_id, etudid=etudid ).first() + sco_cache.EvaluationCache.delete(evaluation_id) + notes_db = sco_evaluation_db.do_evaluation_get_all_notes( + evaluation_id + ) raise ScoBugCatcher( - f"dup: existing={existing_note} value={value}" + f"dup: existing={existing_note} etudid={repr(etudid)} value={value} in_db={etudid in notes_db}" ) from exc changed = True else: diff --git a/app/static/js/saisie_notes.js b/app/static/js/saisie_notes.js index 0936b3d7..208368ca 100644 --- a/app/static/js/saisie_notes.js +++ b/app/static/js/saisie_notes.js @@ -51,6 +51,7 @@ function save_note(elem, v, etudid) { 'comment': document.getElementById('formnotes_comment').value }, function (result) { + $('#sco_msg').hide(); if (result['nbchanged'] > 0) { sco_message("enregistré"); elem.className = "note_saved"; diff --git a/sco_version.py b/sco_version.py index 9f0f321e..5043b4d8 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.78" +SCOVERSION = "9.4.79" SCONAME = "ScoDoc" From c5f5cb7daacfa9df262483671c3322a458036a56 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 31 May 2023 14:24:36 +0200 Subject: [PATCH 2/2] Fix regression: saisie notes tableur --- app/scodoc/sco_saisie_notes.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 594ee20b..e5d7f3da 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -885,21 +885,18 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]): indication_date = evaluation.jour.isoformat() else: indication_date = scu.sanitize_filename(evaluation.description or "")[:12] - eval_name = "%s-%s" % (evaluation.moduleimpl.module.code, indication_date) + eval_name = f"{evaluation.moduleimpl.module.code}-{indication_date}" - if evaluation.description: - evaltitre = "%s du %s" % ( - evaluation.description, - evaluation.jour.strftime("%d/%m/%Y"), - ) - else: - evaltitre = "évaluation du %s" % evaluation.jour.strftime("%d/%m/%Y") - description = "%s en %s (%s) resp. %s" % ( - evaltitre, - evaluation.moduleimpl.module.abbrev or "", - evaluation.moduleimpl.module.code, - mod_responsable["prenomnom"], + date_str = ( + f"""du {evaluation.jour.strftime("%d/%m/%Y")}""" + if evaluation.jour + else "(sans date)" ) + eval_titre = f"""{evaluation.description if evaluation.description else "évaluation"} {date_str}""" + + description = f"""{eval_titre} en {evaluation.moduleimpl.module.abbrev or ""} ({ + evaluation.moduleimpl.module.code + }) resp. {mod_responsable["prenomnom"]}""" groups_infos = sco_groups_view.DisplayedGroupsInfos( group_ids=group_ids, @@ -909,10 +906,8 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]): ) groups = sco_groups.listgroups(groups_infos.group_ids) gr_title_filename = sco_groups.listgroups_filename(groups) - # gr_title = sco_groups.listgroups_abbrev(groups) if None in [g["group_name"] for g in groups]: # tous les etudiants getallstudents = True - # gr_title = "tous" gr_title_filename = "tous" else: getallstudents = False @@ -924,7 +919,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]): ] # une liste de liste de chaines: lignes de la feuille de calcul - L = [] + rows = [] etuds = _get_sorted_etuds(evaluation, etudids, formsemestre.id) for e in etuds: @@ -932,7 +927,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]): groups = sco_groups.get_etud_groups(etudid, formsemestre.id) grc = sco_groups.listgroups_abbrev(groups) - L.append( + rows.append( [ str(etudid), e["nom"].upper(), @@ -944,9 +939,9 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]): ] ) - filename = "notes_%s_%s" % (eval_name, gr_title_filename) + filename = f"notes_{eval_name}_{gr_title_filename}" xls = sco_excel.excel_feuille_saisie( - evaluation, formsemestre.titre_annee(), description, lines=L + evaluation, formsemestre.titre_annee(), description, lines=rows ) return scu.send_file(xls, filename, scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE)