forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -52,7 +52,8 @@ def formations():
|
||||
@as_json
|
||||
def formations_ids():
|
||||
"""
|
||||
Retourne la liste de toutes les id de formations (tous départements)
|
||||
Retourne la liste de toutes les id de formations
|
||||
(tous départements, ou du département indiqué dans la route)
|
||||
|
||||
Exemple de résultat : [ 17, 99, 32 ]
|
||||
"""
|
||||
|
@ -23,9 +23,12 @@ from app.models.but_refcomp import (
|
||||
from app.scodoc.sco_exceptions import ScoFormatError, ScoValueError
|
||||
|
||||
|
||||
def orebut_import_refcomp(xml_data: str, dept_id: int, orig_filename=None):
|
||||
def orebut_import_refcomp(
|
||||
xml_data: str, dept_id: int, orig_filename=None
|
||||
) -> ApcReferentielCompetences:
|
||||
"""Importation XML Orébut
|
||||
peut lever TypeError ou ScoFormatError
|
||||
L'objet créé est ajouté et commité.
|
||||
Résultat: instance de ApcReferentielCompetences
|
||||
"""
|
||||
# Vérifie que le même fichier n'a pas déjà été chargé:
|
||||
@ -41,7 +44,7 @@ def orebut_import_refcomp(xml_data: str, dept_id: int, orig_filename=None):
|
||||
try:
|
||||
root = ElementTree.XML(xml_data)
|
||||
except ElementTree.ParseError as exc:
|
||||
raise ScoFormatError(f"fichier XML Orébut invalide (2): {exc.args}")
|
||||
raise ScoFormatError(f"fichier XML Orébut invalide (2): {exc.args}") from exc
|
||||
if root.tag != "referentiel_competence":
|
||||
raise ScoFormatError("élément racine 'referentiel_competence' manquant")
|
||||
args = ApcReferentielCompetences.attr_from_xml(root.attrib)
|
||||
@ -60,7 +63,8 @@ def orebut_import_refcomp(xml_data: str, dept_id: int, orig_filename=None):
|
||||
# ne devrait plus se produire car pas d'unicité de l'id: donc inutile
|
||||
db.session.rollback()
|
||||
raise ScoValueError(
|
||||
f"""Un référentiel a déjà été chargé avec les mêmes compétences ! ({competence.attrib["id"]})
|
||||
f"""Un référentiel a déjà été chargé avec les mêmes compétences ! ({
|
||||
competence.attrib["id"]})
|
||||
"""
|
||||
) from exc
|
||||
ref.competences.append(c)
|
||||
|
@ -332,28 +332,29 @@ def fiche_etud(etudid=None):
|
||||
)
|
||||
|
||||
# fiche admission
|
||||
infos_admission = _infos_admission(etud, restrict_etud_data)
|
||||
has_adm_notes = any(
|
||||
infos_admission[k] for k in ("math", "physique", "anglais", "francais")
|
||||
)
|
||||
has_bac_info = any(
|
||||
infos_admission[k]
|
||||
for k in (
|
||||
"bac_specialite",
|
||||
"annee_bac",
|
||||
"rapporteur",
|
||||
"commentaire",
|
||||
"classement",
|
||||
"type_admission",
|
||||
"rap",
|
||||
if etud.admission:
|
||||
infos_admission = _infos_admission(etud, restrict_etud_data)
|
||||
has_adm_notes = any(
|
||||
infos_admission[k] for k in ("math", "physique", "anglais", "francais")
|
||||
)
|
||||
)
|
||||
if has_bac_info or has_adm_notes:
|
||||
adm_tmpl = """<!-- Donnees admission -->
|
||||
<div class="fichetitre">Informations admission</div>
|
||||
"""
|
||||
if has_adm_notes:
|
||||
adm_tmpl += """
|
||||
has_bac_info = any(
|
||||
infos_admission[k]
|
||||
for k in (
|
||||
"bac_specialite",
|
||||
"annee_bac",
|
||||
"rapporteur",
|
||||
"commentaire",
|
||||
"classement",
|
||||
"type_admission",
|
||||
"rap",
|
||||
)
|
||||
)
|
||||
if has_bac_info or has_adm_notes:
|
||||
adm_tmpl = """<!-- Donnees admission -->
|
||||
<div class="fichetitre">Informations admission</div>
|
||||
"""
|
||||
if has_adm_notes:
|
||||
adm_tmpl += """
|
||||
<table>
|
||||
<tr><th>Bac</th><th>Année</th><th>Rg</th>
|
||||
<th>Math</th><th>Physique</th><th>Anglais</th><th>Français</th></tr>
|
||||
@ -364,24 +365,26 @@ def fiche_etud(etudid=None):
|
||||
<td>%(math)s</td><td>%(physique)s</td><td>%(anglais)s</td><td>%(francais)s</td>
|
||||
</tr>
|
||||
</table>
|
||||
"""
|
||||
adm_tmpl += """
|
||||
<div>Bac %(bac_specialite)s obtenu en %(annee_bac)s </div>
|
||||
<div class="info_lycee">%(info_lycee)s</div>"""
|
||||
if infos_admission["type_admission"] or infos_admission["classement"]:
|
||||
adm_tmpl += """<div class="vadmission">"""
|
||||
if infos_admission["type_admission"]:
|
||||
adm_tmpl += """<span>Voie d'admission: <span class="etud_type_admission">%(type_admission)s</span></span> """
|
||||
if infos_admission["classement"]:
|
||||
adm_tmpl += """<span>Rang admission: <span class="etud_type_admission">%(classement)s</span></span>"""
|
||||
if infos_admission["type_admission"] or infos_admission["classement"]:
|
||||
adm_tmpl += "</div>"
|
||||
if infos_admission["rap"]:
|
||||
adm_tmpl += """<div class="note_rapporteur">%(rap)s</div>"""
|
||||
adm_tmpl += """</div>"""
|
||||
"""
|
||||
adm_tmpl += """
|
||||
<div>Bac %(bac_specialite)s obtenu en %(annee_bac)s </div>
|
||||
<div class="info_lycee">%(info_lycee)s</div>"""
|
||||
if infos_admission["type_admission"] or infos_admission["classement"]:
|
||||
adm_tmpl += """<div class="vadmission">"""
|
||||
if infos_admission["type_admission"]:
|
||||
adm_tmpl += """<span>Voie d'admission: <span class="etud_type_admission">%(type_admission)s</span></span> """
|
||||
if infos_admission["classement"]:
|
||||
adm_tmpl += """<span>Rang admission: <span class="etud_type_admission">%(classement)s</span></span>"""
|
||||
if infos_admission["type_admission"] or infos_admission["classement"]:
|
||||
adm_tmpl += "</div>"
|
||||
if infos_admission["rap"]:
|
||||
adm_tmpl += """<div class="note_rapporteur">%(rap)s</div>"""
|
||||
adm_tmpl += """</div>"""
|
||||
else:
|
||||
adm_tmpl = "" # pas de boite "info admission"
|
||||
info["adm_data"] = adm_tmpl % infos_admission
|
||||
else:
|
||||
adm_tmpl = "" # pas de boite "info admission"
|
||||
info["adm_data"] = adm_tmpl % infos_admission
|
||||
info["adm_data"] = ""
|
||||
|
||||
# Fichiers archivés:
|
||||
info["fichiers_archive_htm"] = (
|
||||
@ -654,7 +657,7 @@ def _format_adresse(adresse: Adresse | None) -> dict:
|
||||
|
||||
|
||||
def _infos_admission(etud: Identite, restrict_etud_data: bool) -> dict:
|
||||
"""dict with adminission data, restricted or not"""
|
||||
"""dict with admission data, restricted or not"""
|
||||
# info sur rapporteur et son commentaire
|
||||
rap = ""
|
||||
if not restrict_etud_data:
|
||||
@ -799,8 +802,11 @@ def etud_info_html(etudid, with_photo="1", debug=False):
|
||||
code_cursus, _ = sco_report.get_code_cursus_etud(
|
||||
etud, formsemestres=etud.get_formsemestres(), prefix="S", separator=", "
|
||||
)
|
||||
bac = sco_bac.Baccalaureat(etud.admission.bac, etud.admission.specialite)
|
||||
bac_abbrev = bac.abbrev()
|
||||
if etud.admission:
|
||||
bac = sco_bac.Baccalaureat(etud.admission.bac, etud.admission.specialite)
|
||||
bac_abbrev = bac.abbrev()
|
||||
else:
|
||||
bac_abbrev = "-"
|
||||
H = f"""<div class="etud_info_div">
|
||||
<div class="eid_left">
|
||||
<div class="eid_nom"><div><a class="stdlink" target="_blank" href="{
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.951"
|
||||
SCOVERSION = "9.6.952"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user