1
0
forked from ScoDoc/ScoDoc

correction bulletin etudiant pdf + suppression de la fonction précédement créer qui était inutil

This commit is contained in:
leonard_montalbano 2022-05-23 15:46:36 +02:00
parent 62e57d9ca0
commit f4aa04bb76
2 changed files with 7 additions and 57 deletions

View File

@ -8,7 +8,7 @@
API : accès aux étudiants API : accès aux étudiants
""" """
from flask import jsonify from flask import jsonify, make_response
import app import app
from app.api import bp from app.api import bp
@ -18,7 +18,7 @@ from app.api.tools import get_last_instance_etud_from_etudid_or_nip_or_ine
from app.models import Departement, FormSemestreInscription, FormSemestre, Identite from app.models import Departement, FormSemestreInscription, FormSemestre, Identite
from app.scodoc import sco_bulletins from app.scodoc import sco_bulletins
from app.scodoc import sco_groups from app.scodoc import sco_groups
from app.scodoc.sco_bulletins_pdf import get_bulletin_etud_formsemestre_pdf from app.scodoc.sco_bulletins import do_formsemestre_bulletinetud
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
@ -464,8 +464,11 @@ def etudiant_bulletin_semestre( # XXX TODO Ajouter la possibilité de retourner
app.set_sco_dept(dept.acronym) app.set_sco_dept(dept.acronym)
if pdf: if pdf:
return get_bulletin_etud_formsemestre_pdf(etudid, formsemestre_id, version) response = make_response(
do_formsemestre_bulletinetud(formsemestre, etudid, version, "pdf")
)
response.headers["Content-Type"] = "application/json"
return response
return sco_bulletins.get_formsemestre_bulletin_etud_json( return sco_bulletins.get_formsemestre_bulletin_etud_json(
formsemestre, etud, version formsemestre, etud, version

View File

@ -271,59 +271,6 @@ def get_etud_bulletins_pdf(etudid, version="selectedevals"):
return pdfdoc, filename return pdfdoc, filename
def get_bulletin_etud_formsemestre_pdf(etudid: int, formsemestre_id: int, version: str = "long"):
"""
Retourne le bulletin au format pdf d'un semestre d'un etudiant
etudid : l'id de l'étudiant
formsemestre_id : l'id d'un semestre
"""
from app.scodoc import sco_bulletins
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
# fragments = []
bookmarks = {}
filigrannes = {}
formsemestre = FormSemestre.query.get(formsemestre_id)
fragments, filigranne = sco_bulletins.do_formsemestre_bulletinetud(
formsemestre,
etudid,
format="pdfpart",
version=version,
)
# fragments.append(frag)
filigrannes[0] = filigranne
# bookmarks[i] = sem["session_id"] # eg RT-DUT-FI-S1-2015
infos = {"DeptName": sco_preferences.get_preference("DeptName")}
if request:
server_name = request.url_root
else:
server_name = ""
try:
sco_pdf.PDFLOCK.acquire()
pdfdoc = assemble_bulletins_pdf(
formsemestre_id,
fragments,
etud["nomprenom"],
infos,
bookmarks,
filigranne=filigrannes,
server_name=server_name,
)
finally:
sco_pdf.PDFLOCK.release()
#
filename = "bul-%s" % (etud["nomprenom"])
filename = (
scu.unescape_html(filename).replace(" ", "_").replace("&", "").replace(".", "")
+ ".pdf"
)
return pdfdoc, filename
def get_filigranne(etud_etat: str, prefs, decision_sem=None) -> str: def get_filigranne(etud_etat: str, prefs, decision_sem=None) -> str:
"""Texte à placer en "filigranne" sur le bulletin pdf""" """Texte à placer en "filigranne" sur le bulletin pdf"""
if etud_etat == scu.DEMISSION: if etud_etat == scu.DEMISSION: