forked from ScoDoc/ScoDoc
BUT: création module: choix semestre et non plus UE
This commit is contained in:
parent
514623e8cf
commit
3ef1f155b7
@ -33,6 +33,7 @@ from flask_login import current_user
|
||||
from app import db
|
||||
from app.models import Formation, UniteEns, Matiere, Module, FormSemestre, ModuleImpl
|
||||
from app.models.notes import ScolarFormSemestreValidation
|
||||
from app.scodoc.sco_codes_parcours import UE_SPORT
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc.sco_utils import ModuleType
|
||||
@ -99,12 +100,19 @@ def html_edit_formation_apc(
|
||||
ressources_in_sem = ressources.filter_by(semestre_id=semestre_idx)
|
||||
saes_in_sem = saes.filter_by(semestre_id=semestre_idx)
|
||||
other_modules_in_sem = other_modules.filter_by(semestre_id=semestre_idx)
|
||||
matiere_parent = Matiere.query.filter(
|
||||
Matiere.ue_id == UniteEns.id,
|
||||
UniteEns.formation_id == formation.id,
|
||||
UniteEns.semestre_idx == semestre_idx,
|
||||
UniteEns.type != UE_SPORT,
|
||||
).first()
|
||||
H += [
|
||||
render_template(
|
||||
"pn/form_mods.html",
|
||||
formation=formation,
|
||||
titre=f"Ressources du S{semestre_idx}",
|
||||
create_element_msg="créer une nouvelle ressource",
|
||||
matiere_parent=matiere_parent,
|
||||
modules=ressources_in_sem,
|
||||
module_type=ModuleType.RESSOURCE,
|
||||
editable=editable,
|
||||
@ -117,6 +125,7 @@ def html_edit_formation_apc(
|
||||
formation=formation,
|
||||
titre=f"Situations d'Apprentissage et d'Évaluation (SAÉs) S{semestre_idx}",
|
||||
create_element_msg="créer une nouvelle SAÉ",
|
||||
matiere_parent=matiere_parent,
|
||||
modules=saes_in_sem,
|
||||
module_type=ModuleType.SAE,
|
||||
editable=editable,
|
||||
|
@ -145,7 +145,7 @@ def module_create(matiere_id=None, module_type=None, semestre_id=None):
|
||||
]
|
||||
if is_apc:
|
||||
H += [
|
||||
f"""<h2>Création {object_name} dans la formation {ue.formation.acronyme}</h2>"""
|
||||
f"""<h2>Création {object_name} dans la formation {ue.formation.acronyme}, Semestre {ue.semestre_idx}, {ue.acronyme}</h2>"""
|
||||
]
|
||||
else:
|
||||
H += [
|
||||
@ -191,35 +191,7 @@ def module_create(matiere_id=None, module_type=None, semestre_id=None):
|
||||
),
|
||||
]
|
||||
semestres_indices = list(range(1, parcours.NB_SEM + 1))
|
||||
if is_apc: # BUT: choix de l'UE de rattachement (qui donnera le semestre)
|
||||
descr += [
|
||||
(
|
||||
"ue_id",
|
||||
{
|
||||
"input_type": "menu",
|
||||
"type": "int",
|
||||
"title": "UE de rattachement",
|
||||
"explanation": "utilisée pour la présentation dans certains documents",
|
||||
"labels": [f"{u.acronyme} {u.titre}" for u in ues],
|
||||
"allowed_values": [u.id for u in ues],
|
||||
},
|
||||
),
|
||||
]
|
||||
else:
|
||||
# Formations classiques: choix du semestre
|
||||
descr += [
|
||||
(
|
||||
"semestre_id",
|
||||
{
|
||||
"input_type": "menu",
|
||||
"type": "int",
|
||||
"title": parcours.SESSION_NAME.capitalize(),
|
||||
"explanation": "%s du module" % parcours.SESSION_NAME,
|
||||
"labels": [str(x) for x in semestres_indices],
|
||||
"allowed_values": semestres_indices,
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
descr += [
|
||||
(
|
||||
"module_type",
|
||||
@ -318,12 +290,7 @@ def module_create(matiere_id=None, module_type=None, semestre_id=None):
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||
else:
|
||||
if is_apc:
|
||||
# BUT: l'UE indique le semestre
|
||||
selected_ue = UniteEns.query.get(tf[2]["ue_id"])
|
||||
if selected_ue is None:
|
||||
raise ValueError("UE invalide")
|
||||
tf[2]["semestre_id"] = selected_ue.semestre_idx
|
||||
tf[2]["semestre_id"] = ue.semestre_idx
|
||||
|
||||
_ = do_module_create(tf[2])
|
||||
|
||||
@ -719,6 +686,8 @@ def module_edit(module_id=None):
|
||||
</li></ul>
|
||||
</div>
|
||||
"""
|
||||
else:
|
||||
sem_descr = ""
|
||||
#
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + sem_descr + html_sco_header.sco_footer()
|
||||
|
@ -71,12 +71,12 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% if editable and formation.ues.count() and formation.ues[0].matieres.count() %}
|
||||
{% if editable and matiere_parent %}
|
||||
<li><a class="stdlink" href="{{
|
||||
url_for("notes.module_create",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
module_type=module_type|int,
|
||||
matiere_id=formation.ues[0].matieres.first().id
|
||||
matiere_id=matiere_parent.id
|
||||
)}}"
|
||||
>{{create_element_msg}}</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user