Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
4 changed files with 57 additions and 46 deletions
Showing only changes of commit 763f60fb3d - Show all commits

View File

@ -52,7 +52,8 @@ def formations():
@as_json @as_json
def formations_ids(): 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 ] Exemple de résultat : [ 17, 99, 32 ]
""" """

View File

@ -23,9 +23,12 @@ from app.models.but_refcomp import (
from app.scodoc.sco_exceptions import ScoFormatError, ScoValueError 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 """Importation XML Orébut
peut lever TypeError ou ScoFormatError peut lever TypeError ou ScoFormatError
L'objet créé est ajouté et commité.
Résultat: instance de ApcReferentielCompetences Résultat: instance de ApcReferentielCompetences
""" """
# Vérifie que le même fichier n'a pas déjà été chargé: # 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: try:
root = ElementTree.XML(xml_data) root = ElementTree.XML(xml_data)
except ElementTree.ParseError as exc: 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": if root.tag != "referentiel_competence":
raise ScoFormatError("élément racine 'referentiel_competence' manquant") raise ScoFormatError("élément racine 'referentiel_competence' manquant")
args = ApcReferentielCompetences.attr_from_xml(root.attrib) 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 # ne devrait plus se produire car pas d'unicité de l'id: donc inutile
db.session.rollback() db.session.rollback()
raise ScoValueError( 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 ) from exc
ref.competences.append(c) ref.competences.append(c)

View File

@ -332,28 +332,29 @@ def fiche_etud(etudid=None):
) )
# fiche admission # fiche admission
infos_admission = _infos_admission(etud, restrict_etud_data) if etud.admission:
has_adm_notes = any( infos_admission = _infos_admission(etud, restrict_etud_data)
infos_admission[k] for k in ("math", "physique", "anglais", "francais") 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",
) )
) has_bac_info = any(
if has_bac_info or has_adm_notes: infos_admission[k]
adm_tmpl = """<!-- Donnees admission --> for k in (
<div class="fichetitre">Informations admission</div> "bac_specialite",
""" "annee_bac",
if has_adm_notes: "rapporteur",
adm_tmpl += """ "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> <table>
<tr><th>Bac</th><th>Année</th><th>Rg</th> <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> <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> <td>%(math)s</td><td>%(physique)s</td><td>%(anglais)s</td><td>%(francais)s</td>
</tr> </tr>
</table> </table>
""" """
adm_tmpl += """ adm_tmpl += """
<div>Bac %(bac_specialite)s obtenu en %(annee_bac)s </div> <div>Bac %(bac_specialite)s obtenu en %(annee_bac)s </div>
<div class="info_lycee">%(info_lycee)s</div>""" <div class="info_lycee">%(info_lycee)s</div>"""
if infos_admission["type_admission"] or infos_admission["classement"]: if infos_admission["type_admission"] or infos_admission["classement"]:
adm_tmpl += """<div class="vadmission">""" adm_tmpl += """<div class="vadmission">"""
if infos_admission["type_admission"]: if infos_admission["type_admission"]:
adm_tmpl += """<span>Voie d'admission: <span class="etud_type_admission">%(type_admission)s</span></span> """ adm_tmpl += """<span>Voie d'admission: <span class="etud_type_admission">%(type_admission)s</span></span> """
if infos_admission["classement"]: if infos_admission["classement"]:
adm_tmpl += """<span>Rang admission: <span class="etud_type_admission">%(classement)s</span></span>""" adm_tmpl += """<span>Rang admission: <span class="etud_type_admission">%(classement)s</span></span>"""
if infos_admission["type_admission"] or infos_admission["classement"]: if infos_admission["type_admission"] or infos_admission["classement"]:
adm_tmpl += "</div>" adm_tmpl += "</div>"
if infos_admission["rap"]: if infos_admission["rap"]:
adm_tmpl += """<div class="note_rapporteur">%(rap)s</div>""" adm_tmpl += """<div class="note_rapporteur">%(rap)s</div>"""
adm_tmpl += """</div>""" adm_tmpl += """</div>"""
else:
adm_tmpl = "" # pas de boite "info admission"
info["adm_data"] = adm_tmpl % infos_admission
else: else:
adm_tmpl = "" # pas de boite "info admission" info["adm_data"] = ""
info["adm_data"] = adm_tmpl % infos_admission
# Fichiers archivés: # Fichiers archivés:
info["fichiers_archive_htm"] = ( 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: 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 # info sur rapporteur et son commentaire
rap = "" rap = ""
if not restrict_etud_data: 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( code_cursus, _ = sco_report.get_code_cursus_etud(
etud, formsemestres=etud.get_formsemestres(), prefix="S", separator=", " etud, formsemestres=etud.get_formsemestres(), prefix="S", separator=", "
) )
bac = sco_bac.Baccalaureat(etud.admission.bac, etud.admission.specialite) if etud.admission:
bac_abbrev = bac.abbrev() bac = sco_bac.Baccalaureat(etud.admission.bac, etud.admission.specialite)
bac_abbrev = bac.abbrev()
else:
bac_abbrev = "-"
H = f"""<div class="etud_info_div"> H = f"""<div class="etud_info_div">
<div class="eid_left"> <div class="eid_left">
<div class="eid_nom"><div><a class="stdlink" target="_blank" href="{ <div class="eid_nom"><div><a class="stdlink" target="_blank" href="{

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.951" SCOVERSION = "9.6.952"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"