forked from ScoDoc/DocScoDoc
fonction get_formsemestre_bulletin_etud_json
This commit is contained in:
parent
5379e4b93a
commit
d000e7b5a7
@ -7,7 +7,6 @@ from app.comp import df_cache
|
|||||||
from app.models import SHORT_STR_LEN
|
from app.models import SHORT_STR_LEN
|
||||||
from app.models.modules import Module
|
from app.models.modules import Module
|
||||||
from app.models.ues import UniteEns
|
from app.models.ues import UniteEns
|
||||||
from app.scodoc import notesdb as ndb
|
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
|
@ -32,7 +32,7 @@ import email
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from flask import g, request
|
from flask import g, request
|
||||||
from flask import flash, render_template, url_for
|
from flask import flash, jsonify, render_template, url_for
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app import email
|
from app import email
|
||||||
@ -76,6 +76,34 @@ from app.scodoc import sco_bulletins_legacy
|
|||||||
from app.scodoc import sco_bulletins_ucac # format expérimental UCAC Cameroun
|
from app.scodoc import sco_bulletins_ucac # format expérimental UCAC Cameroun
|
||||||
|
|
||||||
|
|
||||||
|
def get_formsemestre_bulletin_etud_json(
|
||||||
|
formsemestre: FormSemestre,
|
||||||
|
etud: Identite,
|
||||||
|
force_publishing=False,
|
||||||
|
version="long",
|
||||||
|
) -> str:
|
||||||
|
"""Le JSON du bulletin d'un étudiant, quel que soit le type de formation."""
|
||||||
|
if formsemestre.formation.is_apc():
|
||||||
|
r = bulletin_but.BulletinBUT(formsemestre)
|
||||||
|
return jsonify(
|
||||||
|
r.bulletin_etud(
|
||||||
|
etud,
|
||||||
|
formsemestre,
|
||||||
|
force_publishing=force_publishing,
|
||||||
|
version=version,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return formsemestre_bulletinetud(
|
||||||
|
etud,
|
||||||
|
formsemestre_id=formsemestre.id,
|
||||||
|
format="json",
|
||||||
|
version=version,
|
||||||
|
xml_with_decisions=True,
|
||||||
|
force_publishing=force_publishing,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
def make_context_dict(formsemestre: FormSemestre, etud: dict) -> dict:
|
def make_context_dict(formsemestre: FormSemestre, etud: dict) -> dict:
|
||||||
"""Construit dictionnaire avec valeurs pour substitution des textes
|
"""Construit dictionnaire avec valeurs pour substitution des textes
|
||||||
(preferences bul_pdf_*)
|
(preferences bul_pdf_*)
|
||||||
@ -799,7 +827,10 @@ def formsemestre_bulletinetud(
|
|||||||
force_publishing=False, # force publication meme si semestre non publie sur "portail"
|
force_publishing=False, # force publication meme si semestre non publie sur "portail"
|
||||||
prefer_mail_perso=False,
|
prefer_mail_perso=False,
|
||||||
):
|
):
|
||||||
"page bulletin de notes"
|
"""Page bulletin de notes
|
||||||
|
pour les formations classiques hors BUT (page HTML)
|
||||||
|
ou le format "oldjson".
|
||||||
|
"""
|
||||||
format = format or "html"
|
format = format or "html"
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
||||||
if not formsemestre:
|
if not formsemestre:
|
||||||
|
@ -312,18 +312,11 @@ def formsemestre_bulletinetud(
|
|||||||
raise ScoValueError(
|
raise ScoValueError(
|
||||||
"Paramètre manquant: spécifier etudid, code_nip ou code_ine"
|
"Paramètre manquant: spécifier etudid, code_nip ou code_ine"
|
||||||
)
|
)
|
||||||
if formsemestre.formation.is_apc() and format != "oldjson":
|
|
||||||
if format == "json":
|
if format == "json":
|
||||||
r = bulletin_but.BulletinBUT(formsemestre)
|
return sco_bulletins.get_formsemestre_bulletin_etud_json(
|
||||||
return jsonify(
|
formsemestre, etud, version=version
|
||||||
r.bulletin_etud(
|
|
||||||
etud,
|
|
||||||
formsemestre,
|
|
||||||
force_publishing=force_publishing,
|
|
||||||
version=version,
|
|
||||||
)
|
)
|
||||||
)
|
if formsemestre.formation.is_apc() and format == "html":
|
||||||
elif format == "html":
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"but/bulletin.html",
|
"but/bulletin.html",
|
||||||
appreciations=models.BulAppreciations.query.filter_by(
|
appreciations=models.BulAppreciations.query.filter_by(
|
||||||
@ -355,10 +348,6 @@ def formsemestre_bulletinetud(
|
|||||||
version=version,
|
version=version,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (etudid or code_nip or code_ine):
|
|
||||||
raise ScoValueError(
|
|
||||||
"Paramètre manquant: spécifier code_nip ou etudid ou code_ine"
|
|
||||||
)
|
|
||||||
if format == "oldjson":
|
if format == "oldjson":
|
||||||
format = "json"
|
format = "json"
|
||||||
r = sco_bulletins.formsemestre_bulletinetud(
|
r = sco_bulletins.formsemestre_bulletinetud(
|
||||||
|
Loading…
Reference in New Issue
Block a user