forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -41,13 +41,11 @@ from app.models import FormSemestre
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_preferences
|
||||
|
||||
from app.pe import pe_comp
|
||||
from app.pe import pe_jury
|
||||
from app.pe import pe_avislatex
|
||||
|
||||
|
||||
def _pe_view_sem_recap_form(formsemestre_id):
|
||||
@ -140,82 +138,6 @@ def pe_view_sem_recap(
|
||||
|
||||
jury = pe_jury.JuryPE(diplome, sem_base.formation.formation_id)
|
||||
|
||||
# Ajout avis LaTeX au même zip:
|
||||
# etudids = list(jury.syntheseJury.keys())
|
||||
|
||||
# Récupération du template latex, du footer latex et du tag identifiant les annotations relatives aux PE
|
||||
# (chaines unicodes, html non quoté)
|
||||
template_latex = ""
|
||||
# template fourni via le formulaire Web
|
||||
if False:
|
||||
if avis_tmpl_file:
|
||||
try:
|
||||
template_latex = avis_tmpl_file.read().decode("utf-8")
|
||||
except UnicodeDecodeError as e:
|
||||
raise ScoValueError(
|
||||
"Données (template) invalides (caractères non UTF8 ?)"
|
||||
) from e
|
||||
else:
|
||||
# template indiqué dans préférences ScoDoc ?
|
||||
template_latex = pe_avislatex.get_code_latex_from_scodoc_preference(
|
||||
formsemestre_id, champ="pe_avis_latex_tmpl"
|
||||
)
|
||||
|
||||
template_latex = template_latex.strip()
|
||||
if not template_latex:
|
||||
# pas de preference pour le template: utilise fichier du serveur
|
||||
template_latex = pe_avislatex.get_templates_from_distrib("avis")
|
||||
|
||||
# Footer:
|
||||
footer_latex = ""
|
||||
# template fourni via le formulaire Web
|
||||
if footer_tmpl_file:
|
||||
footer_latex = footer_tmpl_file.read().decode("utf-8")
|
||||
else:
|
||||
footer_latex = pe_avislatex.get_code_latex_from_scodoc_preference(
|
||||
formsemestre_id, champ="pe_avis_latex_footer"
|
||||
)
|
||||
footer_latex = footer_latex.strip()
|
||||
if not footer_latex:
|
||||
# pas de preference pour le footer: utilise fichier du serveur
|
||||
footer_latex = pe_avislatex.get_templates_from_distrib(
|
||||
"footer"
|
||||
) # fallback: footer vides
|
||||
|
||||
tag_annotation_pe = pe_avislatex.get_code_latex_from_scodoc_preference(
|
||||
formsemestre_id, champ="pe_tag_annotation_avis_latex"
|
||||
)
|
||||
|
||||
# Ajout des annotations PE dans un fichier excel
|
||||
# sT = pe_avislatex.table_syntheseAnnotationPE(jury.syntheseJury, tag_annotation_pe)
|
||||
# if sT:
|
||||
# jury.add_file_to_zip(
|
||||
# jury.nom_export_zip + "_annotationsPE" + scu.XLSX_SUFFIX, sT.excel()
|
||||
# )
|
||||
|
||||
if False:
|
||||
latex_pages = {} # Dictionnaire de la forme nom_fichier => contenu_latex
|
||||
for etudid in etudids:
|
||||
[nom_fichier, contenu_latex] = pe_avislatex.get_avis_poursuite_par_etudiant(
|
||||
jury,
|
||||
etudid,
|
||||
template_latex,
|
||||
tag_annotation_pe,
|
||||
footer_latex,
|
||||
prefs,
|
||||
)
|
||||
jury.add_file_to_zip("avis/" + nom_fichier + ".tex", contenu_latex)
|
||||
latex_pages[nom_fichier] = contenu_latex # Sauvegarde dans un dico
|
||||
|
||||
# Nouvelle version : 1 fichier par étudiant avec 1 fichier appelant créée ci-dessous
|
||||
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)
|
||||
|
||||
# Ajoute image, LaTeX class file(s) and modeles
|
||||
pe_tools.add_pe_stuff_to_zip(jury.zipfile, jury.nom_export_zip)
|
||||
|
||||
data = jury.get_zipped_data()
|
||||
|
||||
return send_file(
|
||||
|
Loading…
Reference in New Issue
Block a user