This commit is contained in:
Emmanuel Viennet 2023-01-13 20:05:39 -03:00 committed by iziram
parent 10148bc7c0
commit 5e0922a4bf
3 changed files with 20 additions and 12 deletions

View File

@ -28,7 +28,7 @@
"""Form choix modules / responsables et creation formsemestre
"""
import flask
from flask import url_for, flash
from flask import url_for, flash, redirect
from flask import g, request
from flask_login import current_user
@ -177,10 +177,12 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
uid2display[u.id] = u.get_nomplogin()
allowed_user_names = list(uid2display.values()) + [""]
#
formation_id = int(vals["formation_id"])
formation = Formation.query.get(formation_id)
if formation is None:
raise ScoValueError("Formation inexistante !")
if formsemestre:
formation = formsemestre.formation
else:
formation_id = int(vals["formation_id"])
formation = Formation.query.get_or_404(formation_id)
is_apc = formation.is_apc()
if not edit:
initvalues = {"titre": _default_sem_title(formation)}
@ -236,7 +238,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
else:
modules = (
Module.query.filter(
Module.formation_id == formation_id, UniteEns.id == Module.ue_id
Module.formation_id == formation.id, UniteEns.id == Module.ue_id
)
.order_by(Module.module_type, UniteEns.numero, Module.numero)
.all()
@ -254,7 +256,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
#
modform = [
("formsemestre_id", {"input_type": "hidden"}),
("formation_id", {"input_type": "hidden", "default": formation_id}),
("formation_id", {"input_type": "hidden", "default": formation.id}),
(
"date_debut",
{
@ -435,7 +437,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
)
if edit:
formtit = f"""
<p><a href="{url_for("notes.formsemestre_edit_uecoefs",
<p><a class="stdlink" href="{url_for("notes.formsemestre_edit_uecoefs",
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id)
}">Modifier les coefficients des UE capitalisées</a>
</p>
@ -772,7 +774,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
if tf[0] == 0 or msg:
return f"""<p>Formation <a class="discretelink" href="{
url_for("notes.ue_table", scodoc_dept=g.scodoc_dept,
formation_id=formation_id)
formation_id=formation.id)
}"><em>{formation.titre}</em> ({formation.acronyme}), version {
formation.version}, code {formation.formation_code}</a>
</p>
@ -1769,7 +1771,13 @@ def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + footer
elif tf[0] == -1:
return "<h4>annulation</h4>"
return redirect(
url_for(
"notes.formsemestre_editwithmodules",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
)
)
else:
# change values
# 1- supprime les coef qui ne sont plus forcés

View File

@ -102,7 +102,7 @@ def formsemestre_synchro_etuds(
if not sem["etapes"]:
raise ScoValueError(
"""opération impossible: ce semestre n'a pas de code étape
(voir "<a href="formsemestre_editwithmodules?formation_id=%(formation_id)s&formsemestre_id=%(formsemestre_id)s">Modifier ce semestre</a>")
(voir "<a href="formsemestre_editwithmodules?formsemestre_id=%(formsemestre_id)s">Modifier ce semestre</a>")
"""
% sem
)

View File

@ -957,7 +957,7 @@ def edit_enseignants_form(moduleimpl_id):
<p class="help">Pour changer le responsable du module, passez par la
page "<a class="stdlink" href="{
url_for("notes.formsemestre_editwithmodules", scodoc_dept=g.scodoc_dept,
formation_id=sem["formation_id"], formsemestre_id=M["formsemestre_id"])
formsemestre_id=M["formsemestre_id"])
}">Modification du semestre</a>",
accessible uniquement au responsable de la formation (chef de département)
</p>