forked from ScoDoc/ScoDoc
wip poursuite d etudes
This commit is contained in:
parent
ce31d3148d
commit
5ea4e74117
@ -33,9 +33,9 @@
|
||||
import os
|
||||
import codecs
|
||||
import re
|
||||
from app.pe import pe_jurype
|
||||
from app.pe import pe_tagtable
|
||||
from app.pe import pe_tools
|
||||
from app.scodoc import pe_jurype
|
||||
from app.scodoc import pe_tagtable
|
||||
from app.scodoc import pe_tools
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
@ -48,7 +48,7 @@ from app.scodoc import sco_etud
|
||||
DEBUG = False # Pour debug et repérage des prints à changer en Log
|
||||
|
||||
DONNEE_MANQUANTE = (
|
||||
u"" # Caractère de remplacement des données manquantes dans un avis PE
|
||||
"" # Caractère de remplacement des données manquantes dans un avis PE
|
||||
)
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
@ -102,17 +102,17 @@ def comp_latex_parcourstimeline(etudiant, promo, taille=17):
|
||||
result: chaine unicode (EV:)
|
||||
"""
|
||||
codelatexDebut = (
|
||||
u"""
|
||||
""""
|
||||
\\begin{parcourstimeline}{**debut**}{**fin**}{**nbreSemestres**}{%d}
|
||||
"""
|
||||
% taille
|
||||
)
|
||||
|
||||
modeleEvent = u"""
|
||||
modeleEvent = """
|
||||
\\parcoursevent{**nosem**}{**nomsem**}{**descr**}
|
||||
"""
|
||||
|
||||
codelatexFin = u"""
|
||||
codelatexFin = """
|
||||
\\end{parcourstimeline}
|
||||
"""
|
||||
reslatex = codelatexDebut
|
||||
@ -125,13 +125,13 @@ def comp_latex_parcourstimeline(etudiant, promo, taille=17):
|
||||
for no_sem in range(etudiant["nbSemestres"]):
|
||||
descr = modeleEvent
|
||||
nom_semestre_dans_parcours = parcours[no_sem]["nom_semestre_dans_parcours"]
|
||||
descr = descr.replace(u"**nosem**", str(no_sem + 1))
|
||||
descr = descr.replace("**nosem**", str(no_sem + 1))
|
||||
if no_sem % 2 == 0:
|
||||
descr = descr.replace(u"**nomsem**", nom_semestre_dans_parcours)
|
||||
descr = descr.replace(u"**descr**", u"")
|
||||
descr = descr.replace("**nomsem**", nom_semestre_dans_parcours)
|
||||
descr = descr.replace("**descr**", "")
|
||||
else:
|
||||
descr = descr.replace(u"**nomsem**", u"")
|
||||
descr = descr.replace(u"**descr**", nom_semestre_dans_parcours)
|
||||
descr = descr.replace("**nomsem**", "")
|
||||
descr = descr.replace("**descr**", nom_semestre_dans_parcours)
|
||||
reslatex += descr
|
||||
reslatex += codelatexFin
|
||||
return reslatex
|
||||
@ -166,7 +166,7 @@ def get_code_latex_avis_etudiant(
|
||||
result: chaine unicode
|
||||
"""
|
||||
if not donnees_etudiant or not un_avis_latex: # Cas d'un template vide
|
||||
return annotationPE if annotationPE else u""
|
||||
return annotationPE if annotationPE else ""
|
||||
|
||||
# Le template latex (corps + footer)
|
||||
code = un_avis_latex + "\n\n" + footer_latex
|
||||
@ -189,17 +189,17 @@ def get_code_latex_avis_etudiant(
|
||||
)
|
||||
|
||||
# La macro parcourstimeline
|
||||
elif tag_latex == u"parcourstimeline":
|
||||
elif tag_latex == "parcourstimeline":
|
||||
valeur = comp_latex_parcourstimeline(
|
||||
donnees_etudiant, donnees_etudiant["promo"]
|
||||
)
|
||||
|
||||
# Le tag annotationPE
|
||||
elif tag_latex == u"annotation":
|
||||
elif tag_latex == "annotation":
|
||||
valeur = annotationPE
|
||||
|
||||
# Le tag bilanParTag
|
||||
elif tag_latex == u"bilanParTag":
|
||||
elif tag_latex == "bilanParTag":
|
||||
valeur = get_bilanParTag(donnees_etudiant)
|
||||
|
||||
# Les tags "simples": par ex. nom, prenom, civilite, ...
|
||||
@ -249,14 +249,14 @@ def get_annotation_PE(etudid, tag_annotation_pe):
|
||||
]["comment_u"]
|
||||
|
||||
annotationPE = exp.sub(
|
||||
u"", annotationPE
|
||||
"", annotationPE
|
||||
) # Suppression du tag d'annotation PE
|
||||
annotationPE = annotationPE.replace(u"\r", u"") # Suppression des \r
|
||||
annotationPE = annotationPE.replace("\r", "") # Suppression des \r
|
||||
annotationPE = annotationPE.replace(
|
||||
u"<br/>", u"\n\n"
|
||||
"<br/>", "\n\n"
|
||||
) # Interprète les retours chariots html
|
||||
return annotationPE
|
||||
return u"" # pas d'annotations
|
||||
return "" # pas d'annotations
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
@ -282,7 +282,7 @@ def str_from_syntheseJury(donnees_etudiant, aggregat, groupe, tag_scodoc, champ)
|
||||
):
|
||||
donnees_numeriques = donnees_etudiant[aggregat][groupe][tag_scodoc]
|
||||
if champ == "rang":
|
||||
valeur = u"%s/%d" % (
|
||||
valeur = "%s/%d" % (
|
||||
donnees_numeriques[
|
||||
pe_tagtable.TableTag.FORMAT_DONNEES_ETUDIANTS.index("rang")
|
||||
],
|
||||
@ -303,9 +303,9 @@ def str_from_syntheseJury(donnees_etudiant, aggregat, groupe, tag_scodoc, champ)
|
||||
if isinstance(
|
||||
donnees_numeriques[indice_champ], float
|
||||
): # valeur numérique avec formattage unicode
|
||||
valeur = u"%2.2f" % donnees_numeriques[indice_champ]
|
||||
valeur = "%2.2f" % donnees_numeriques[indice_champ]
|
||||
else:
|
||||
valeur = u"%s" % donnees_numeriques[indice_champ]
|
||||
valeur = "%s" % donnees_numeriques[indice_champ]
|
||||
|
||||
return valeur
|
||||
|
||||
@ -356,29 +356,29 @@ def get_bilanParTag(donnees_etudiant, groupe="groupe"):
|
||||
("\\textit{" + rang + "}") if note else ""
|
||||
) # rang masqué si pas de notes
|
||||
|
||||
code_latex = u"\\begin{tabular}{|c|" + "|c" * (len(entete)) + "|}\n"
|
||||
code_latex += u"\\hline \n"
|
||||
code_latex = "\\begin{tabular}{|c|" + "|c" * (len(entete)) + "|}\n"
|
||||
code_latex += "\\hline \n"
|
||||
code_latex += (
|
||||
u" & "
|
||||
" & "
|
||||
+ " & ".join(["\\textbf{" + intitule + "}" for (agg, intitule, _) in entete])
|
||||
+ " \\\\ \n"
|
||||
)
|
||||
code_latex += u"\\hline"
|
||||
code_latex += u"\\hline \n"
|
||||
code_latex += "\\hline"
|
||||
code_latex += "\\hline \n"
|
||||
for (i, ligne_val) in enumerate(valeurs["note"]):
|
||||
titre = lignes[i] # règle le pb d'encodage
|
||||
code_latex += (
|
||||
u"\\textbf{" + titre + u"} & " + " & ".join(ligne_val) + u"\\\\ \n"
|
||||
"\\textbf{" + titre + "} & " + " & ".join(ligne_val) + "\\\\ \n"
|
||||
)
|
||||
code_latex += (
|
||||
u" & "
|
||||
+ u" & ".join(
|
||||
[u"{\\scriptsize " + clsmt + u"}" for clsmt in valeurs["rang"][i]]
|
||||
" & "
|
||||
+ " & ".join(
|
||||
["{\\scriptsize " + clsmt + "}" for clsmt in valeurs["rang"][i]]
|
||||
)
|
||||
+ u"\\\\ \n"
|
||||
+ "\\\\ \n"
|
||||
)
|
||||
code_latex += u"\\hline \n"
|
||||
code_latex += u"\\end{tabular}"
|
||||
code_latex += "\\hline \n"
|
||||
code_latex += "\\end{tabular}"
|
||||
|
||||
return code_latex
|
||||
|
||||
@ -397,22 +397,12 @@ def get_avis_poursuite_par_etudiant(
|
||||
nom = jury.syntheseJury[etudid]["nom"].replace(" ", "-")
|
||||
prenom = jury.syntheseJury[etudid]["prenom"].replace(" ", "-")
|
||||
|
||||
nom_fichier = (
|
||||
u"avis_poursuite_"
|
||||
+ pe_tools.remove_accents(nom)
|
||||
+ "_"
|
||||
+ pe_tools.remove_accents(prenom)
|
||||
+ "_"
|
||||
+ str(etudid)
|
||||
)
|
||||
nom_fichier = scu.sanitize_filename("avis_poursuite_%s_%s_%s" % (nom, prenom, etudid))
|
||||
if pe_tools.PE_DEBUG:
|
||||
pe_tools.pe_print("fichier latex =" + nom_fichier, type(nom_fichier))
|
||||
|
||||
# Entete (commentaire)
|
||||
|
||||
contenu_latex = (
|
||||
u"%% ---- Etudiant: " + civilite_str + " " + nom + " " + prenom + u"\n"
|
||||
)
|
||||
contenu_latex = "%% ---- Etudiant: " + civilite_str + " " + nom + " " + prenom + "\n"
|
||||
|
||||
# les annnotations
|
||||
annotationPE = get_annotation_PE(etudid, tag_annotation_pe=tag_annotation_pe)
|
||||
|
@ -52,10 +52,10 @@ from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_codes_parcours # sco_codes_parcours.NEXT -> sem suivant
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.pe import pe_tagtable
|
||||
from app.pe import pe_tools
|
||||
from app.pe import pe_semestretag
|
||||
from app.pe import pe_settag
|
||||
from app.scodoc import pe_tagtable
|
||||
from app.scodoc import pe_tools
|
||||
from app.scodoc import pe_semestretag
|
||||
from app.scodoc import pe_settag
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
def comp_nom_semestre_dans_parcours(sem):
|
||||
@ -946,7 +946,7 @@ class JuryPE(object):
|
||||
return list(taglist)
|
||||
|
||||
def get_allTagInSyntheseJury(self):
|
||||
"""Extrait tous les tags du dictionnaire syntheseJury trié par ordre alphabétique. [] si aucun tag"""
|
||||
"""Extrait tous les tags du dictionnaire syntheseJury trié par ordre alphabétique. [] si aucun tag """
|
||||
allTags = set()
|
||||
for nom in JuryPE.PARCOURS.keys():
|
||||
allTags = allTags.union(set(self.get_allTagForAggregat(nom)))
|
||||
@ -1149,12 +1149,10 @@ class JuryPE(object):
|
||||
|
||||
# **********************************************
|
||||
def calcul_anneePromoDUT_d_un_etudiant(self, etudid):
|
||||
"""Calcule et renvoie la date de diplome prévue pour un étudiant fourni
|
||||
avec son etudid en fonction de sesSemestres de scolarisation
|
||||
et -1 s'il n'y a pas de semestre.
|
||||
"""
|
||||
"""Calcule et renvoie la date de diplome prévue pour un étudiant fourni avec son etudid
|
||||
en fonction de sesSemestres de scolarisation"""
|
||||
sesSemestres = self.get_semestresDUT_d_un_etudiant(etudid)
|
||||
return max([get_annee_diplome_semestre(sem) for sem in sesSemestres] or -1)
|
||||
return max([get_annee_diplome_semestre(sem) for sem in sesSemestres])
|
||||
|
||||
# *********************************************
|
||||
# Fonctions d'affichage pour debug
|
||||
|
@ -40,7 +40,7 @@ from app import log
|
||||
from app.scodoc import sco_codes_parcours
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_tag_module
|
||||
from app.pe import pe_tagtable
|
||||
from app.scodoc import pe_tagtable
|
||||
|
||||
|
||||
class SemestreTag(pe_tagtable.TableTag):
|
||||
|
@ -36,8 +36,8 @@ Created on Fri Sep 9 09:15:05 2016
|
||||
@author: barasc
|
||||
"""
|
||||
|
||||
from app.pe.pe_tools import pe_print, PE_DEBUG
|
||||
from app.pe import pe_tagtable
|
||||
from app.scodoc.pe_tools import pe_print, PE_DEBUG
|
||||
from app.scodoc import pe_tagtable
|
||||
|
||||
|
||||
class SetTag(pe_tagtable.TableTag):
|
||||
|
@ -168,6 +168,7 @@ def add_local_file_to_zip(zipfile, ziproot, pathname, path_in_zip):
|
||||
"""Read pathname server file and add content to zip under path_in_zip"""
|
||||
rooted_path_in_zip = os.path.join(ziproot, path_in_zip)
|
||||
data = open(pathname).read()
|
||||
breakpoint()
|
||||
zipfile.writestr(rooted_path_in_zip, data)
|
||||
|
||||
|
||||
@ -209,7 +210,7 @@ def add_pe_stuff_to_zip(zipfile, ziproot):
|
||||
for f in logos_names:
|
||||
logo = os.path.join(scu.SCODOC_LOGOS_DIR, f)
|
||||
if os.path.isfile(logo):
|
||||
add_local_file_to_zip(zipfile, ziproot, logo, "avis/logos/" + f)
|
||||
add_local_file_to_zip(zipfile, ziproot, logo, "avis/logos/" + f, mode='rb')
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
|
@ -42,10 +42,9 @@ from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_preferences
|
||||
|
||||
from app.pe import pe_tools
|
||||
from app.pe.pe_tools import PE_LATEX_ENCODING
|
||||
from app.pe import pe_jurype
|
||||
from app.pe import pe_avislatex
|
||||
from app.scodoc import pe_tools
|
||||
from app.scodoc import pe_jurype
|
||||
from app.scodoc import pe_avislatex
|
||||
|
||||
|
||||
def _pe_view_sem_recap_form(formsemestre_id):
|
||||
@ -152,8 +151,8 @@ def pe_view_sem_recap(
|
||||
)
|
||||
|
||||
jury.add_file_to_zip(
|
||||
("avis/" + nom_fichier + ".tex").encode(PE_LATEX_ENCODING),
|
||||
contenu_latex.encode(PE_LATEX_ENCODING),
|
||||
"avis/" + nom_fichier + ".tex",
|
||||
contenu_latex,
|
||||
)
|
||||
latex_pages[nom_fichier] = contenu_latex # Sauvegarde dans un dico
|
||||
|
||||
@ -161,7 +160,7 @@ def pe_view_sem_recap(
|
||||
doc_latex = "\n% -----\n".join(
|
||||
["\\include{" + nom + "}" for nom in sorted(latex_pages.keys())]
|
||||
)
|
||||
jury.add_file_to_zip("avis/avis_poursuite.tex", doc_latex.encode(PE_LATEX_ENCODING))
|
||||
jury.add_file_to_zip("avis/avis_poursuite.tex", doc_latex)
|
||||
|
||||
# Ajoute image, LaTeX class file(s) and modeles
|
||||
pe_tools.add_pe_stuff_to_zip(jury.zipfile, jury.NOM_EXPORT_ZIP)
|
||||
|
Loading…
Reference in New Issue
Block a user