read multiple annotations

This commit is contained in:
Jean-Marie PLACE 2022-02-15 09:08:13 +01:00
parent 577cac00ee
commit 23b2c9ebce
1 changed files with 19 additions and 6 deletions

View File

@ -225,6 +225,10 @@ def get_annotation_PE(etudid, tag_annotation_pe):
(cf. .get_preferences -> pe_tag_annotation_avis_latex).
Result: chaine unicode
Modif JMP retourne un dictionnaire {
None : annotation de base
<ecole> : annotation spécifique pour l'école
}
"""
if tag_annotation_pe:
cnx = ndb.GetDBConnexion()
@ -255,7 +259,16 @@ def get_annotation_PE(etudid, tag_annotation_pe):
annotationPE = annotationPE.replace(
"<br/>", "\n\n"
) # Interprète les retours chariots html
return annotationPE
# Patch JMP build dictionnary of annotations
annotations = {}
split = annotationPE.split("@")
annotations[None] = split[0]
for specifique in split[1:]:
ecole, annotation = specifique.split(":", 1)
annotations[ecole] = specifique
return annotations
return "" # pas d'annotations
@ -406,10 +419,10 @@ def get_avis_poursuite_par_etudiant(
"%% ---- Etudiant: " + civilite_str + " " + nom + " " + prenom + "\n"
)
# les annnotations
annotationPE = get_annotation_PE(etudid, tag_annotation_pe=tag_annotation_pe)
# les annotations
annotations = get_annotation_PE(etudid, tag_annotation_pe=tag_annotation_pe)
if pe_tools.PE_DEBUG:
pe_tools.pe_print(annotationPE, type(annotationPE))
pe_tools.pe_print(annotations, type(annotations))
# le LaTeX
avis = get_code_latex_avis_etudiant(
@ -502,8 +515,8 @@ def table_syntheseAnnotationPE(syntheseJury, tag_annotation_pe):
n += 1
# L'annotation PE
annotationPE = get_annotation_PE(etudid, tag_annotation_pe=tag_annotation_pe)
row["Annotation PE"] = annotationPE if annotationPE else ""
annotationPE = get_annotation_PE(etudid, tag_annotation_pe=tag_annotation_pe)[None]
row["Annotation PE"] = annotationPE + f" + {len(annotationPE)} specifiques" if annotationPE else ""
rows.append(row)
T = GenTable(