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 import db
|
||||||
from app.models import Formation, UniteEns, Matiere, Module, FormSemestre, ModuleImpl
|
from app.models import Formation, UniteEns, Matiere, Module, FormSemestre, ModuleImpl
|
||||||
from app.models.notes import ScolarFormSemestreValidation
|
from app.models.notes import ScolarFormSemestreValidation
|
||||||
|
from app.scodoc.sco_codes_parcours import UE_SPORT
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc import sco_groups
|
from app.scodoc import sco_groups
|
||||||
from app.scodoc.sco_utils import ModuleType
|
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)
|
ressources_in_sem = ressources.filter_by(semestre_id=semestre_idx)
|
||||||
saes_in_sem = saes.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)
|
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 += [
|
H += [
|
||||||
render_template(
|
render_template(
|
||||||
"pn/form_mods.html",
|
"pn/form_mods.html",
|
||||||
formation=formation,
|
formation=formation,
|
||||||
titre=f"Ressources du S{semestre_idx}",
|
titre=f"Ressources du S{semestre_idx}",
|
||||||
create_element_msg="créer une nouvelle ressource",
|
create_element_msg="créer une nouvelle ressource",
|
||||||
|
matiere_parent=matiere_parent,
|
||||||
modules=ressources_in_sem,
|
modules=ressources_in_sem,
|
||||||
module_type=ModuleType.RESSOURCE,
|
module_type=ModuleType.RESSOURCE,
|
||||||
editable=editable,
|
editable=editable,
|
||||||
@ -117,6 +125,7 @@ def html_edit_formation_apc(
|
|||||||
formation=formation,
|
formation=formation,
|
||||||
titre=f"Situations d'Apprentissage et d'Évaluation (SAÉs) S{semestre_idx}",
|
titre=f"Situations d'Apprentissage et d'Évaluation (SAÉs) S{semestre_idx}",
|
||||||
create_element_msg="créer une nouvelle SAÉ",
|
create_element_msg="créer une nouvelle SAÉ",
|
||||||
|
matiere_parent=matiere_parent,
|
||||||
modules=saes_in_sem,
|
modules=saes_in_sem,
|
||||||
module_type=ModuleType.SAE,
|
module_type=ModuleType.SAE,
|
||||||
editable=editable,
|
editable=editable,
|
||||||
|
@ -145,7 +145,7 @@ def module_create(matiere_id=None, module_type=None, semestre_id=None):
|
|||||||
]
|
]
|
||||||
if is_apc:
|
if is_apc:
|
||||||
H += [
|
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:
|
else:
|
||||||
H += [
|
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))
|
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 += [
|
descr += [
|
||||||
(
|
(
|
||||||
"module_type",
|
"module_type",
|
||||||
@ -318,12 +290,7 @@ def module_create(matiere_id=None, module_type=None, semestre_id=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
else:
|
else:
|
||||||
if is_apc:
|
tf[2]["semestre_id"] = ue.semestre_idx
|
||||||
# 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
|
|
||||||
|
|
||||||
_ = do_module_create(tf[2])
|
_ = do_module_create(tf[2])
|
||||||
|
|
||||||
@ -719,6 +686,8 @@ def module_edit(module_id=None):
|
|||||||
</li></ul>
|
</li></ul>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
else:
|
||||||
|
sem_descr = ""
|
||||||
#
|
#
|
||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + sem_descr + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + sem_descr + html_sco_header.sco_footer()
|
||||||
|
@ -71,12 +71,12 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if editable and formation.ues.count() and formation.ues[0].matieres.count() %}
|
{% if editable and matiere_parent %}
|
||||||
<li><a class="stdlink" href="{{
|
<li><a class="stdlink" href="{{
|
||||||
url_for("notes.module_create",
|
url_for("notes.module_create",
|
||||||
scodoc_dept=g.scodoc_dept,
|
scodoc_dept=g.scodoc_dept,
|
||||||
module_type=module_type|int,
|
module_type=module_type|int,
|
||||||
matiere_id=formation.ues[0].matieres.first().id
|
matiere_id=matiere_parent.id
|
||||||
)}}"
|
)}}"
|
||||||
>{{create_element_msg}}</a>
|
>{{create_element_msg}}</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user