forked from ScoDoc/ScoDoc
Modernisation d'une partie des accès aux formations
This commit is contained in:
parent
597be47afb
commit
72457a0651
@ -71,6 +71,8 @@ class Formation(db.Model):
|
||||
e.pop("_sa_instance_state", None)
|
||||
if "referentiel_competence" in e:
|
||||
e.pop("referentiel_competence")
|
||||
e["code_specialite"] = e["code_specialite"] or ""
|
||||
e["commentaire"] = e["commentaire"] or ""
|
||||
e["departement"] = self.departement.to_dict()
|
||||
e["formation_id"] = self.id # ScoDoc7 backward compat
|
||||
if with_refcomp_attrs and self.referentiel_competence:
|
||||
@ -289,6 +291,6 @@ class Matiere(db.Model):
|
||||
e = dict(self.__dict__)
|
||||
e.pop("_sa_instance_state", None)
|
||||
# ScoDoc7 output_formators
|
||||
e["ue_id"] = self.id
|
||||
e["numero"] = e["numero"] if e["numero"] else 0
|
||||
e["ue_id"] = self.id
|
||||
return e
|
||||
|
@ -48,7 +48,7 @@ from zipfile import ZipFile
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.models import Formation, FormSemestre
|
||||
|
||||
from app.scodoc.gen_tables import GenTable, SeqGenTable
|
||||
import app.scodoc.sco_utils as scu
|
||||
@ -65,10 +65,8 @@ def comp_nom_semestre_dans_parcours(sem):
|
||||
"""Le nom a afficher pour titrer un semestre
|
||||
par exemple: "semestre 2 FI 2015"
|
||||
"""
|
||||
from app.scodoc import sco_formations
|
||||
|
||||
F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
||||
parcours = codes_cursus.get_cursus_from_code(F["type_parcours"])
|
||||
formation: Formation = Formation.query.get_or_404(sem["formation_id"])
|
||||
parcours = codes_cursus.get_cursus_from_code(formation.type_parcours)
|
||||
return "%s %s %s %s" % (
|
||||
parcours.SESSION_NAME, # eg "semestre"
|
||||
sem["semestre_id"], # eg 2
|
||||
|
@ -42,7 +42,7 @@ from app.scodoc.sco_utils import json_error
|
||||
from app.but import bulletin_but
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import FormSemestre, Identite, ModuleImplInscription
|
||||
from app.models import Formation, FormSemestre, Identite, ModuleImplInscription
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||
from app.scodoc import html_sco_header
|
||||
@ -152,14 +152,9 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
||||
I["server_name"] = request.url_root
|
||||
|
||||
# Formation et parcours
|
||||
formation_dict = None
|
||||
if I["sem"]["formation_id"]:
|
||||
formation_dicts = sco_formations.formation_list(
|
||||
args={"formation_id": I["sem"]["formation_id"]}
|
||||
)
|
||||
if formation_dicts:
|
||||
formation_dict = formation_dicts[0]
|
||||
if formation_dict is None: # what's the fuck ?
|
||||
formation_dict = Formation.query.get_or_404(I["sem"]["formation_id"]).to_dict()
|
||||
else: # what's the fuck ?
|
||||
formation_dict = {
|
||||
"acronyme": "?",
|
||||
"code_specialite": "",
|
||||
|
@ -336,9 +336,7 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
||||
if nb_ue > nb_max_ue:
|
||||
nb_max_ue = nb_ue
|
||||
# add formation_code to each sem:
|
||||
sem["formation_code"] = sco_formations.formation_list(
|
||||
args={"formation_id": sem["formation_id"]}
|
||||
)[0]["formation_code"]
|
||||
sem["formation_code"] = formsemestre.formation.formation_code
|
||||
# si sem peut servir à compenser le semestre courant, positionne
|
||||
# can_compensate
|
||||
sem["can_compensate"] = self.check_compensation_dut(sem, nt)
|
||||
|
@ -54,14 +54,11 @@ from app.scodoc import sco_formsemestre
|
||||
|
||||
def formation_delete(formation_id=None, dialog_confirmed=False):
|
||||
"""Delete a formation"""
|
||||
F = sco_formations.formation_list(args={"formation_id": formation_id})
|
||||
if not F:
|
||||
raise ScoValueError("formation inexistante !")
|
||||
F = F[0]
|
||||
formation: Formation = Formation.query.get_or_404(formation_id)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Suppression d'une formation"),
|
||||
"""<h2>Suppression de la formation %(titre)s (%(acronyme)s)</h2>""" % F,
|
||||
f"""<h2>Suppression de la formation {formation.titre} ({formation.acronyme})</h2>""",
|
||||
]
|
||||
|
||||
sems = sco_formsemestre.do_formsemestre_list({"formation_id": formation_id})
|
||||
@ -80,21 +77,22 @@ def formation_delete(formation_id=None, dialog_confirmed=False):
|
||||
else:
|
||||
if not dialog_confirmed:
|
||||
return scu.confirm_dialog(
|
||||
"""<h2>Confirmer la suppression de la formation %(titre)s (%(acronyme)s) ?</h2>
|
||||
<p><b>Attention:</b> la suppression d'une formation est <b>irréversible</b> et implique la supression de toutes les UE, matières et modules de la formation !
|
||||
f"""<h2>Confirmer la suppression de la formation
|
||||
{formation.titre} ({formation.acronyme}) ?
|
||||
</h2>
|
||||
<p><b>Attention:</b> la suppression d'une formation est <b>irréversible</b>
|
||||
et implique la supression de toutes les UE, matières et modules de la formation !
|
||||
</p>
|
||||
"""
|
||||
% F,
|
||||
""",
|
||||
OK="Supprimer cette formation",
|
||||
cancel_url=scu.NotesURL(),
|
||||
parameters={"formation_id": formation_id},
|
||||
)
|
||||
else:
|
||||
do_formation_delete(F["formation_id"])
|
||||
do_formation_delete(formation_id)
|
||||
H.append(
|
||||
"""<p>OK, formation supprimée.</p>
|
||||
<p><a class="stdlink" href="%s">continuer</a></p>"""
|
||||
% scu.NotesURL()
|
||||
f"""<p>OK, formation supprimée.</p>
|
||||
<p><a class="stdlink" href="{scu.NotesURL()}">continuer</a></p>"""
|
||||
)
|
||||
|
||||
H.append(html_sco_header.sco_footer())
|
||||
@ -297,10 +295,10 @@ def do_formation_create(args):
|
||||
a = args.copy()
|
||||
if "formation_id" in a:
|
||||
del a["formation_id"]
|
||||
F = sco_formations.formation_list(args=a)
|
||||
if len(F) > 0:
|
||||
log("do_formation_create: error: %d formations matching args=%s" % (len(F), a))
|
||||
raise ScoValueError("Formation non unique (%s) !" % str(a))
|
||||
f_dicts = sco_formations.formation_list(args=a)
|
||||
if len(f_dicts) > 0:
|
||||
log(f"do_formation_create: error: {len(f_dicts)} formations matching args={a}")
|
||||
raise ScoValueError(f"Formation non unique ({a}) !")
|
||||
# Si pas de formation_code, l'enleve (default SQL)
|
||||
if "formation_code" in args and not args["formation_code"]:
|
||||
del args["formation_code"]
|
||||
|
@ -253,7 +253,6 @@ def matiere_delete(matiere_id=None):
|
||||
|
||||
def matiere_edit(matiere_id=None):
|
||||
"""Edit matiere"""
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_edit_ue
|
||||
|
||||
F = matiere_list(args={"matiere_id": matiere_id})
|
||||
@ -264,15 +263,14 @@ def matiere_edit(matiere_id=None):
|
||||
if not ues:
|
||||
raise ScoValueError("UE inexistante !")
|
||||
ue = ues[0]
|
||||
Fo = sco_formations.formation_list(args={"formation_id": ue["formation_id"]})[0]
|
||||
|
||||
formation: Formation = Formation.query.get_or_404(ue["formation_id"])
|
||||
ues = sco_edit_ue.ue_list(args={"formation_id": ue["formation_id"]})
|
||||
ue_names = ["%(acronyme)s (%(titre)s)" % u for u in ues]
|
||||
ue_ids = [u["ue_id"] for u in ues]
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Modification d'une matière"),
|
||||
"""<h2>Modification de la matière %(titre)s""" % F,
|
||||
"""(formation %(acronyme)s, version %(version)s)</h2>""" % Fo,
|
||||
f"""(formation ({formation.acronyme}, version {formation.version})</h2>""",
|
||||
]
|
||||
help = """<p class="help">Les matières sont des groupes de modules dans une UE
|
||||
d'une formation donnée. Les matières servent surtout pour la
|
||||
|
@ -900,21 +900,27 @@ def module_table(formation_id):
|
||||
|
||||
if not formation_id:
|
||||
raise ScoValueError("invalid formation !")
|
||||
F = sco_formations.formation_list(args={"formation_id": formation_id})[0]
|
||||
formation: Formation = Formation.query.get_or_404(formation_id)
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Liste des modules de %(titre)s" % F),
|
||||
"""<h2>Listes des modules dans la formation %(titre)s (%(acronyme)s)</h2>"""
|
||||
% F,
|
||||
'<ul class="notes_module_list">',
|
||||
html_sco_header.sco_header(
|
||||
page_title=f"Liste des modules de {formation.titre}"
|
||||
),
|
||||
f"""<h2>Listes des modules dans la formation {formation.titre} ({formation.acronyme}</h2>
|
||||
<ul class="notes_module_list">
|
||||
""",
|
||||
]
|
||||
editable = current_user.has_permission(Permission.ScoChangeFormation)
|
||||
|
||||
for Mod in module_list(args={"formation_id": formation_id}):
|
||||
H.append('<li class="notes_module_list">%s' % Mod)
|
||||
for module_dict in module_list(args={"formation_id": formation_id}):
|
||||
H.append('<li class="notes_module_list">%s' % module_dict)
|
||||
if editable:
|
||||
H.append('<a href="module_edit?module_id=%(module_id)s">modifier</a>' % Mod)
|
||||
H.append(
|
||||
'<a href="module_delete?module_id=%(module_id)s">supprimer</a>' % Mod
|
||||
'<a href="module_edit?module_id=%(module_id)s">modifier</a>'
|
||||
% module_dict
|
||||
)
|
||||
H.append(
|
||||
'<a href="module_delete?module_id=%(module_id)s">supprimer</a>'
|
||||
% module_dict
|
||||
)
|
||||
H.append("</li>")
|
||||
H.append("</ul>")
|
||||
|
@ -36,10 +36,10 @@ from flask import url_for, g, send_file, request
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app import log
|
||||
from app.models import Formation
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_apogee_csv
|
||||
from app.scodoc import sco_etape_apogee
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_portal_apogee
|
||||
from app.scodoc import sco_preferences
|
||||
@ -341,21 +341,24 @@ def apo_semset_maq_status(
|
||||
if missing:
|
||||
formation_ids = {sem["formation_id"] for sem in semset.sems}
|
||||
formations = [
|
||||
sco_formations.formation_list(formation_id=i)[0] for i in formation_ids
|
||||
Formation.query.get_or_404(formation_id) for formation_id in formation_ids
|
||||
]
|
||||
# log('formations=%s' % formations)
|
||||
H.append(
|
||||
'<div class="apo_csv_status_missing_elems"><span class="fontred">Elements Apogée absents dans ScoDoc: </span><span class="apo_elems fontred">%s</span>'
|
||||
% ", ".join(sorted(missing))
|
||||
)
|
||||
H.append(
|
||||
'<div class="help">Ces éléments de la maquette Apogée ne sont pas déclarés dans ScoDoc et ne seront donc pas remplis.</div><div> Vous pouvez les déclarer dans les programmes pédagogiques: '
|
||||
f"""<div class="apo_csv_status_missing_elems">
|
||||
<span class="fontred">Elements Apogée absents dans ScoDoc: </span>
|
||||
<span class="apo_elems fontred">{
|
||||
", ".join(sorted(missing))
|
||||
}</span>
|
||||
<div class="help">Ces éléments de la maquette Apogée ne sont pas déclarés dans
|
||||
ScoDoc et ne seront donc pas remplis.</div><div> Vous pouvez les déclarer
|
||||
dans les programmes pédagogiques: """
|
||||
)
|
||||
H.append(
|
||||
", ".join(
|
||||
[
|
||||
'<a class="stdlink" href="ue_table?formation_id=%(formation_id)s">%(acronyme)s v%(version)s</a>'
|
||||
% f
|
||||
f"""<a class="stdlink" href="{
|
||||
url_for("notes.ue_table",scodoc_dept=g.scodoc_dept, formation_id=f.id)
|
||||
}">{f.acronyme} v{f.version}</a>"""
|
||||
for f in formations
|
||||
]
|
||||
)
|
||||
|
@ -35,10 +35,10 @@ from app.models import FormSemestre
|
||||
import app.scodoc.notesdb as ndb
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app import log
|
||||
from app.models import Formation
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_bac
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_pvjury
|
||||
@ -65,9 +65,7 @@ def _build_results_table(start_date=None, end_date=None, types_parcours=[]):
|
||||
semlist = [dpv["formsemestre"] for dpv in dpv_by_sem.values() if dpv]
|
||||
semlist_parcours = []
|
||||
for sem in semlist:
|
||||
sem["formation"] = sco_formations.formation_list(
|
||||
args={"formation_id": sem["formation_id"]}
|
||||
)[0]
|
||||
sem["formation"] = Formation.query.get_or_404(sem["formation_id"]).to_dict()
|
||||
sem["parcours"] = codes_cursus.get_cursus_from_code(
|
||||
sem["formation"]["type_parcours"]
|
||||
)
|
||||
|
@ -82,7 +82,7 @@ _formationEditor = ndb.EditableTable(
|
||||
)
|
||||
|
||||
|
||||
def formation_list(formation_id=None, args={}):
|
||||
def formation_list(formation_id=None, args={}): ### XXX obsolete, à supprimer
|
||||
"""List formation(s) with given id, or matching args
|
||||
(when args is given, formation_id is ignored).
|
||||
"""
|
||||
@ -295,14 +295,10 @@ def formation_import_xml(doc: str, import_tags=True, use_local_refcomp=False):
|
||||
referentiel_competence_id = _formation_retreive_refcomp(f_dict)
|
||||
f_dict["referentiel_competence_id"] = referentiel_competence_id
|
||||
# find new version number
|
||||
formations = sco_formations.formation_list(
|
||||
args={
|
||||
"acronyme": f_dict["acronyme"],
|
||||
"titre": f_dict["titre"],
|
||||
"dept_id": f_dict["dept_id"],
|
||||
}
|
||||
formations = Formation.query.filter_by(
|
||||
acronyme=f_dict["acronyme"], titre=f_dict["titre"], dept_id=f_dict["dept_id"]
|
||||
)
|
||||
if formations:
|
||||
if formations.count():
|
||||
version = max(f["version"] or 0 for f in formations)
|
||||
else:
|
||||
version = 0
|
||||
|
@ -38,7 +38,7 @@ import app.scodoc.notesdb as ndb
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app import log
|
||||
from app.models import Departement
|
||||
from app.models import FormSemestre
|
||||
from app.models import Formation, FormSemestre
|
||||
from app.scodoc import sco_cache, codes_cursus, sco_formations, sco_preferences
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc.codes_cursus import NO_SEMESTRE_ID
|
||||
@ -145,13 +145,8 @@ def _formsemestre_enrich(sem):
|
||||
# imports ici pour eviter refs circulaires
|
||||
from app.scodoc import sco_formsemestre_edit
|
||||
|
||||
formations = sco_formations.formation_list(
|
||||
args={"formation_id": sem["formation_id"]}
|
||||
)
|
||||
if not formations:
|
||||
raise ScoValueError("pas de formation pour ce semestre !")
|
||||
F = formations[0]
|
||||
parcours = codes_cursus.get_cursus_from_code(F["type_parcours"])
|
||||
formation: Formation = Formation.query.get_or_404(sem["formation_id"])
|
||||
parcours = codes_cursus.get_cursus_from_code(formation.type_parcours)
|
||||
# 'S1', 'S2', ... ou '' pour les monosemestres
|
||||
if sem["semestre_id"] != NO_SEMESTRE_ID:
|
||||
sem["sem_id_txt"] = "S%s" % sem["semestre_id"]
|
||||
@ -216,7 +211,7 @@ def _formsemestre_enrich(sem):
|
||||
sem["mois_fin"],
|
||||
)
|
||||
sem["session_id"] = sco_formsemestre_edit.get_formsemestre_session_id(
|
||||
sem, F, parcours
|
||||
sem, formation.code_specialite, parcours
|
||||
)
|
||||
sem["etapes"] = read_formsemestre_etapes(sem["formsemestre_id"])
|
||||
sem["etapes_apo_str"] = formsemestre_etape_apo_str(sem)
|
||||
|
@ -1866,7 +1866,7 @@ def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None):
|
||||
|
||||
|
||||
# ----- identification externe des sessions (pour SOJA et autres logiciels)
|
||||
def get_formsemestre_session_id(sem, F, parcours):
|
||||
def get_formsemestre_session_id(sem, code_specialite, parcours):
|
||||
"""Identifiant de session pour ce semestre
|
||||
Obsolete: vooir FormSemestre.session_id() #sco7
|
||||
"""
|
||||
@ -1885,9 +1885,11 @@ def get_formsemestre_session_id(sem, F, parcours):
|
||||
decale = scu.sem_decale_str(sem)
|
||||
semestre_id = "S%d" % sem["semestre_id"] + decale
|
||||
else:
|
||||
semestre_id = F["code_specialite"]
|
||||
semestre_id = code_specialite
|
||||
annee_sco = str(scu.annee_scolaire_debut(sem["annee_debut"], sem["mois_debut_ord"]))
|
||||
|
||||
return scu.sanitize_string(
|
||||
"-".join((imputation_dept, parcours_type, modalite, semestre_id, annee_sco))
|
||||
"-".join(
|
||||
(imputation_dept, parcours_type, modalite, semestre_id or "", annee_sco)
|
||||
)
|
||||
)
|
||||
|
@ -40,6 +40,7 @@ from flask_login import current_user
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import (
|
||||
Formation,
|
||||
FormSemestre,
|
||||
FormSemestreUECoef,
|
||||
Identite,
|
||||
@ -54,7 +55,6 @@ from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_formsemestre_inscriptions
|
||||
from app.scodoc import sco_formsemestre_validation
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc.codes_cursus import UE_SPORT
|
||||
|
||||
|
||||
@ -63,11 +63,9 @@ def formsemestre_ext_create(etudid, sem_params):
|
||||
sem_params: dict nécessaire à la création du formsemestre
|
||||
"""
|
||||
# Check args
|
||||
_formation = sco_formations.formation_list(
|
||||
args={"formation_id": sem_params["formation_id"]}
|
||||
)[0]
|
||||
_ = Formation.query.get_or_404(sem_params["formation_id"])
|
||||
if etudid:
|
||||
_etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
_ = Identite.query.get_or_404(etudid)
|
||||
|
||||
# Create formsemestre
|
||||
sem_params["modalite"] = "EXT"
|
||||
|
@ -616,10 +616,7 @@ def formsemestre_description_table(
|
||||
).first_or_404()
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
use_ue_coefs = sco_preferences.get_preference("use_ue_coefs", formsemestre_id)
|
||||
F = sco_formations.formation_list(args={"formation_id": formsemestre.formation_id})[
|
||||
0
|
||||
]
|
||||
parcours = codes_cursus.get_cursus_from_code(F["type_parcours"])
|
||||
parcours = codes_cursus.get_cursus_from_code(formsemestre.formation.type_parcours)
|
||||
# --- Colonnes à proposer:
|
||||
columns_ids = ["UE", "Code", "Module"]
|
||||
if with_parcours:
|
||||
|
@ -30,7 +30,7 @@
|
||||
import time
|
||||
|
||||
import flask
|
||||
from flask import url_for, g, request
|
||||
from flask import url_for, flash, g, request
|
||||
from app.models.etudiants import Identite
|
||||
|
||||
import app.scodoc.notesdb as ndb
|
||||
@ -39,7 +39,7 @@ from app import db, log
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import FormSemestre, UniteEns
|
||||
from app.models import Formation, FormSemestre, UniteEns
|
||||
from app.models.notes import etud_has_notes_attente
|
||||
from app.models.validations import (
|
||||
ScolarAutorisationInscription,
|
||||
@ -1066,8 +1066,7 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid):
|
||||
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
Fo = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
||||
|
||||
formation: Formation = Formation.query.get_or_404(sem["formation_id"])
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title="Validation UE",
|
||||
@ -1083,23 +1082,24 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid):
|
||||
sco_photos.etud_photo_html(etud, title="fiche de %s" % etud["nom"]),
|
||||
)
|
||||
),
|
||||
"""<p class="help">Utiliser cette page pour enregistrer une UE validée antérieurement,
|
||||
f"""<p class="help">Utiliser cette page pour enregistrer une UE validée antérieurement,
|
||||
<em>dans un semestre hors ScoDoc</em>.</p>
|
||||
<p><b>Les UE validées dans ScoDoc sont déjà
|
||||
automatiquement prises en compte</b>. Cette page n'est utile que pour les étudiants ayant
|
||||
suivi un début de cursus dans <b>un autre établissement</b>, ou bien dans un semestre géré <b>sans
|
||||
ScoDoc</b> et qui <b>redouble</b> ce semestre (<em>ne pas utiliser pour les semestres précédents !</em>).
|
||||
ScoDoc</b> et qui <b>redouble</b> ce semestre
|
||||
(<em>ne pas utiliser pour les semestres précédents !</em>).
|
||||
</p>
|
||||
<p>Notez que l'UE est validée, avec enregistrement immédiat de la décision et
|
||||
l'attribution des ECTS.</p>""",
|
||||
"<p>On ne peut prendre en compte ici que les UE du cursus <b>%(titre)s</b></p>"
|
||||
% Fo,
|
||||
l'attribution des ECTS.</p>
|
||||
<p>On ne peut prendre en compte ici que les UE du cursus <b>{formation.titre}</b></p>
|
||||
""",
|
||||
]
|
||||
|
||||
# Toutes les UE de cette formation sont présentées (même celles des autres semestres)
|
||||
ues = sco_edit_ue.ue_list({"formation_id": Fo["formation_id"]})
|
||||
ue_names = ["Choisir..."] + ["%(acronyme)s %(titre)s" % ue for ue in ues]
|
||||
ue_ids = [""] + [ue["ue_id"] for ue in ues]
|
||||
ues = formation.ues.order_by(UniteEns.numero)
|
||||
ue_names = ["Choisir..."] + [f"{ue.acronyme} {ue.titre}" for ue in ues]
|
||||
ue_ids = [""] + [ue.id for ue in ues]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
scu.get_request_args(),
|
||||
@ -1155,7 +1155,7 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid):
|
||||
<div id="ue_list_etud_validations"><!-- filled by get_etud_ue_cap_html --></div>
|
||||
<div id="ue_list_code"><!-- filled by ue_sharing_code --></div>
|
||||
"""
|
||||
warn, ue_multiples = check_formation_ues(Fo["formation_id"])
|
||||
warn, ue_multiples = check_formation_ues(formation.id)
|
||||
return "\n".join(H) + tf[1] + X + warn + html_sco_header.sco_footer()
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(
|
||||
@ -1176,10 +1176,14 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid):
|
||||
tf[2]["date"],
|
||||
semestre_id=semestre_id,
|
||||
)
|
||||
flash("Validation d'UE enregistrée")
|
||||
return flask.redirect(
|
||||
scu.ScoURL()
|
||||
+ "/Notes/formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s&head_message=Validation%%20d'UE%%20enregistree"
|
||||
% (formsemestre_id, etudid)
|
||||
url_for(
|
||||
"notes.formsemestre_bulletinetud",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre_id,
|
||||
etudid=etudid,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
@ -58,6 +58,7 @@ from flask import g, request
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import (
|
||||
Formation,
|
||||
FormSemestre,
|
||||
UniteEns,
|
||||
ScolarAutorisationInscription,
|
||||
@ -74,7 +75,6 @@ from app.scodoc import sco_cursus
|
||||
from app.scodoc import sco_cursus_dut
|
||||
from app.scodoc import sco_edit_ue
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_groups_view
|
||||
@ -368,9 +368,7 @@ def dict_pvjury(
|
||||
"is_apc": nt.is_apc,
|
||||
"has_prev": has_prev,
|
||||
"semestre_non_terminal": semestre_non_terminal,
|
||||
"formation": sco_formations.formation_list(
|
||||
args={"formation_id": sem["formation_id"]}
|
||||
)[0],
|
||||
"formation": Formation.query.get_or_404(sem["formation_id"]).to_dict(),
|
||||
"decisions": decisions,
|
||||
"decisions_dict": D,
|
||||
}
|
||||
@ -734,7 +732,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids=[], etudid=None):
|
||||
|
||||
def descrform_pvjury(sem):
|
||||
"""Définition de formulaire pour PV jury PDF"""
|
||||
F = sco_formations.formation_list(formation_id=sem["formation_id"])[0]
|
||||
f_dict = Formation.query.get_or_404(sem["formation_id"]).to_dict()
|
||||
return [
|
||||
(
|
||||
"date_commission",
|
||||
@ -779,7 +777,7 @@ def descrform_pvjury(sem):
|
||||
"size": 64,
|
||||
"title": "Titre du PV",
|
||||
"explanation": "par défaut, titre officiel de la formation",
|
||||
"default": F["titre_officiel"],
|
||||
"default": f_dict["titre_officiel"],
|
||||
},
|
||||
),
|
||||
(
|
||||
|
@ -674,32 +674,6 @@ def index_html():
|
||||
|
||||
# --- Formations
|
||||
|
||||
sco_publish(
|
||||
"/do_formation_create",
|
||||
sco_edit_formation.do_formation_create,
|
||||
Permission.ScoChangeFormation,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
|
||||
sco_publish(
|
||||
"/do_formation_delete",
|
||||
sco_edit_formation.do_formation_delete,
|
||||
Permission.ScoChangeFormation,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/formation_list")
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formation_list(format=None, formation_id=None, args={}):
|
||||
"""List formation(s) with given id, or matching args
|
||||
(when args is given, formation_id is ignored).
|
||||
"""
|
||||
r = sco_formations.formation_list(formation_id=formation_id, args=args)
|
||||
return scu.sendResult(r, name="formation", format=format)
|
||||
|
||||
|
||||
@bp.route("/formation_export")
|
||||
@scodoc
|
||||
|
@ -49,7 +49,7 @@ import os
|
||||
import flask
|
||||
import pytest
|
||||
|
||||
from app.models.moduleimpls import ModuleImpl
|
||||
from app.models import Formation, ModuleImpl
|
||||
from app.scodoc import sco_edit_formation, sco_formsemestre
|
||||
from app.scodoc import sco_edit_matiere
|
||||
from app.scodoc import sco_edit_module
|
||||
@ -155,25 +155,21 @@ def test_formations(test_client):
|
||||
formsemestre_id=formsemestre_idt,
|
||||
)
|
||||
|
||||
# --- Afficher la liste des formations
|
||||
# --- Récupérer la liste des formations
|
||||
|
||||
lif = notes.formation_list(format="json", formation_id=formation_id)
|
||||
# lif est une Response car on a appelé une vue (1er appel)
|
||||
assert isinstance(lif, flask.Response)
|
||||
load_lif = json.loads(lif.get_data().decode("utf-8"))
|
||||
assert len(load_lif) == 1
|
||||
assert load_lif[0]["acronyme"] == f["acronyme"]
|
||||
assert load_lif[0]["titre_officiel"] == f["titre_officiel"]
|
||||
assert load_lif[0]["formation_id"] == formation_id
|
||||
assert load_lif[0]["titre"] == f["titre"]
|
||||
formation = Formation.query.get(formation_id)
|
||||
assert isinstance(formation, Formation)
|
||||
assert formation.acronyme == f["acronyme"]
|
||||
assert formation.titre_officiel == f["titre_officiel"]
|
||||
assert formation.id == formation_id
|
||||
assert formation.titre == f["titre"]
|
||||
|
||||
lif2 = notes.formation_list(format="json").get_data(as_text=True)
|
||||
# lif2 est un chaine
|
||||
assert isinstance(lif2, str)
|
||||
load_lif2 = json.loads(lif2)
|
||||
assert len(load_lif2) == 2
|
||||
assert load_lif2[0] == load_lif[0]
|
||||
assert load_lif2[1]["titre"] == formation2["titre"]
|
||||
f_dict = formation.to_dict()
|
||||
assert isinstance(f_dict, dict)
|
||||
del f_dict["departement"]
|
||||
# pour le test:
|
||||
f_dict["referentiel_competence_id"] = f_dict["referentiel_competence_id"] or ""
|
||||
assert f_dict == f
|
||||
|
||||
# --- Export de formation_id
|
||||
|
||||
@ -324,10 +320,8 @@ def test_formations(test_client):
|
||||
# --- Suppression d'une formation
|
||||
|
||||
sco_edit_formation.do_formation_delete(formation_id=formation_id2)
|
||||
lif3 = notes.formation_list(format="json").get_data(as_text=True)
|
||||
assert isinstance(lif3, str)
|
||||
load_lif3 = json.loads(lif3)
|
||||
assert len(load_lif3) == 1
|
||||
formation = Formation.query.get(formation_id2)
|
||||
assert formation is None
|
||||
|
||||
|
||||
def test_import_formation(test_client, filename="formation-exemple-1.xml"):
|
||||
|
Loading…
Reference in New Issue
Block a user