forked from ScoDoc/ScoDoc
Corrige annulation dispense d'UE APC
This commit is contained in:
parent
0324771aa2
commit
60fa12df81
@ -263,7 +263,9 @@ def formsemestre_status_menubar(formsemestre: FormSemestre) -> str:
|
|||||||
|
|
||||||
menu_inscriptions = [
|
menu_inscriptions = [
|
||||||
{
|
{
|
||||||
"title": "Voir les inscriptions aux modules",
|
"title": "Gérer les inscriptions aux UE et modules"
|
||||||
|
if formsemestre.formation.is_apc()
|
||||||
|
else "Gérer les inscriptions aux modules",
|
||||||
"endpoint": "notes.moduleimpl_inscriptions_stats",
|
"endpoint": "notes.moduleimpl_inscriptions_stats",
|
||||||
"args": {"formsemestre_id": formsemestre_id},
|
"args": {"formsemestre_id": formsemestre_id},
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ def do_moduleimpl_inscription_create(args, formsemestre_id=None):
|
|||||||
except psycopg2.errors.UniqueViolation as exc:
|
except psycopg2.errors.UniqueViolation as exc:
|
||||||
raise ScoValueError(
|
raise ScoValueError(
|
||||||
"Inscription impossible car déjà existante: vérifiez la situation"
|
"Inscription impossible car déjà existante: vérifiez la situation"
|
||||||
)
|
) from exc
|
||||||
sco_cache.invalidate_formsemestre(
|
sco_cache.invalidate_formsemestre(
|
||||||
formsemestre_id=formsemestre_id
|
formsemestre_id=formsemestre_id
|
||||||
) # > moduleimpl_inscription
|
) # > moduleimpl_inscription
|
||||||
|
@ -1620,12 +1620,29 @@ def etud_desinscrit_ue(etudid, formsemestre_id, ue_id):
|
|||||||
@permission_required(Permission.ScoEtudInscrit)
|
@permission_required(Permission.ScoEtudInscrit)
|
||||||
@scodoc7func
|
@scodoc7func
|
||||||
def etud_inscrit_ue(etudid, formsemestre_id, ue_id):
|
def etud_inscrit_ue(etudid, formsemestre_id, ue_id):
|
||||||
"""Inscrit l'etudiant de tous les modules de cette UE dans ce semestre."""
|
"""
|
||||||
sco_moduleimpl_inscriptions.do_etud_inscrit_ue(etudid, formsemestre_id, ue_id)
|
En classic: inscrit l'étudiant à tous les modules de cette UE dans ce semestre.
|
||||||
|
En APC: enlève la dispense de cette UE s'il y en a une.
|
||||||
|
"""
|
||||||
|
formsemestre = FormSemestre.query.filter_by(
|
||||||
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
||||||
|
).first_or_404()
|
||||||
|
etud = Identite.query.get_or_404(etudid)
|
||||||
|
ue = UniteEns.query.get_or_404(ue_id)
|
||||||
|
if ue.formation.is_apc():
|
||||||
|
for disp in DispenseUE.query.filter_by(etudid=etud.id, ue_id=ue_id):
|
||||||
|
db.session.delete(disp)
|
||||||
|
db.session.commit()
|
||||||
|
sco_cache.invalidate_formsemestre(formsemestre_id=formsemestre.id)
|
||||||
|
else:
|
||||||
|
# Formations classiques: joue sur les inscriptions aux modules
|
||||||
|
sco_moduleimpl_inscriptions.do_etud_inscrit_ue(etud.id, formsemestre_id, ue_id)
|
||||||
return flask.redirect(
|
return flask.redirect(
|
||||||
scu.ScoURL()
|
url_for(
|
||||||
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
|
"notes.moduleimpl_inscriptions_stats",
|
||||||
+ str(formsemestre_id)
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
formsemestre_id=formsemestre_id,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user