2022-08-03 13:32:59 +02:00
|
|
|
##############################################################################
|
|
|
|
# ScoDoc
|
2023-12-31 23:04:06 +01:00
|
|
|
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
2022-08-03 13:32:59 +02:00
|
|
|
# See LICENSE
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""
|
2024-07-24 17:34:30 +02:00
|
|
|
ScoDoc 9 API : jury WIP à compléter avec enregistrement décisions.
|
|
|
|
|
|
|
|
|
|
|
|
CATEGORY
|
|
|
|
--------
|
|
|
|
Jury
|
2022-08-03 13:32:59 +02:00
|
|
|
"""
|
|
|
|
|
2023-07-16 19:59:45 +02:00
|
|
|
import datetime
|
|
|
|
|
2023-08-27 22:58:34 +02:00
|
|
|
from flask import g, request, url_for
|
2023-04-06 16:10:32 +02:00
|
|
|
from flask_json import as_json
|
2023-06-25 11:49:11 +02:00
|
|
|
from flask_login import current_user, login_required
|
2022-08-03 13:32:59 +02:00
|
|
|
|
|
|
|
import app
|
2023-06-19 22:07:31 +02:00
|
|
|
from app import db, log
|
2023-07-16 19:59:45 +02:00
|
|
|
from app.api import api_bp as bp, api_web_bp, API_CLIENT_ERROR, tools
|
2024-07-17 12:03:08 +02:00
|
|
|
from app.api import api_permission_required as permission_required
|
|
|
|
from app.decorators import scodoc
|
2022-08-17 18:15:48 +02:00
|
|
|
from app.scodoc.sco_exceptions import ScoException
|
2023-02-06 13:05:39 +01:00
|
|
|
from app.but import jury_but_results
|
2023-06-19 22:07:31 +02:00
|
|
|
from app.models import (
|
2023-07-16 19:59:45 +02:00
|
|
|
ApcParcours,
|
2023-06-19 22:07:31 +02:00
|
|
|
ApcValidationAnnee,
|
|
|
|
ApcValidationRCUE,
|
2023-07-16 19:59:45 +02:00
|
|
|
Formation,
|
2023-06-19 22:07:31 +02:00
|
|
|
FormSemestre,
|
|
|
|
Identite,
|
|
|
|
ScolarAutorisationInscription,
|
|
|
|
ScolarFormSemestreValidation,
|
2023-06-23 10:37:32 +02:00
|
|
|
ScolarNews,
|
2023-07-16 19:59:45 +02:00
|
|
|
Scolog,
|
|
|
|
UniteEns,
|
2024-07-06 23:28:20 +02:00
|
|
|
ValidationDUT120,
|
2023-06-19 22:07:31 +02:00
|
|
|
)
|
2023-07-16 19:59:45 +02:00
|
|
|
from app.scodoc import codes_cursus
|
2023-06-19 22:07:31 +02:00
|
|
|
from app.scodoc import sco_cache
|
2022-08-03 13:32:59 +02:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
2023-06-25 11:49:11 +02:00
|
|
|
from app.scodoc.sco_utils import json_error
|
2022-08-03 13:32:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre/<int:formsemestre_id>/decisions_jury")
|
|
|
|
@api_web_bp.route("/formsemestre/<int:formsemestre_id>/decisions_jury")
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
2023-04-06 16:10:32 +02:00
|
|
|
@as_json
|
2022-08-03 13:32:59 +02:00
|
|
|
def decisions_jury(formsemestre_id: int):
|
2024-07-27 13:30:02 +02:00
|
|
|
"""Décisions du jury des étudiants du formsemestre.
|
2024-09-30 02:51:06 +02:00
|
|
|
(fonction disponible uniquement en BUT actuellement).
|
2024-07-27 13:30:02 +02:00
|
|
|
|
|
|
|
SAMPLES
|
|
|
|
-------
|
|
|
|
/formsemestre/1/decisions_jury
|
|
|
|
"""
|
2022-08-03 13:32:59 +02:00
|
|
|
# APC, pair:
|
2023-07-11 06:57:38 +02:00
|
|
|
formsemestre: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
2023-12-22 15:18:20 +01:00
|
|
|
if formsemestre is None:
|
|
|
|
return json_error(
|
|
|
|
404,
|
|
|
|
message="formsemestre inconnu",
|
|
|
|
)
|
2022-08-17 18:15:48 +02:00
|
|
|
if formsemestre.formation.is_apc():
|
|
|
|
app.set_sco_dept(formsemestre.departement.acronym)
|
2023-02-06 13:05:39 +01:00
|
|
|
rows = jury_but_results.get_jury_but_results(formsemestre)
|
2023-04-06 16:10:32 +02:00
|
|
|
return rows
|
2022-08-17 18:15:48 +02:00
|
|
|
else:
|
|
|
|
raise ScoException("non implemente")
|
2023-06-19 22:07:31 +02:00
|
|
|
|
|
|
|
|
2024-07-06 23:28:20 +02:00
|
|
|
def _news_delete_jury_etud(etud: Identite, detail: str = ""):
|
2023-06-23 10:37:32 +02:00
|
|
|
"génère news sur effacement décision"
|
|
|
|
# n'utilise pas g.scodoc_dept, pas toujours dispo en mode API
|
|
|
|
url = url_for(
|
2024-01-20 14:49:36 +01:00
|
|
|
"scolar.fiche_etud", scodoc_dept=etud.departement.acronym, etudid=etud.id
|
2023-06-23 10:37:32 +02:00
|
|
|
)
|
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_JURY,
|
|
|
|
obj=etud.id,
|
2024-07-06 23:28:20 +02:00
|
|
|
text=f"""Suppression décision jury {detail} pour <a href="{url}">{etud.nomprenom}</a>""",
|
2023-06-23 10:37:32 +02:00
|
|
|
url=url,
|
|
|
|
)
|
2024-09-12 14:34:34 +02:00
|
|
|
Scolog.logdb(
|
|
|
|
"jury_delete_manual",
|
|
|
|
etudid=etud.id,
|
|
|
|
msg=f"Validation {detail} effacée",
|
|
|
|
commit=True,
|
|
|
|
)
|
2023-06-23 10:37:32 +02:00
|
|
|
|
|
|
|
|
2023-06-19 22:07:31 +02:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_ue/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_ue/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
2023-06-25 11:49:11 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2023-06-19 22:07:31 +02:00
|
|
|
@as_json
|
|
|
|
def validation_ue_delete(etudid: int, validation_id: int):
|
2024-07-24 17:34:30 +02:00
|
|
|
"Efface cette validation d'UE."
|
2023-06-19 22:07:31 +02:00
|
|
|
return _validation_ue_delete(etudid, validation_id)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_formsemestre/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_formsemestre/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
2023-06-25 11:49:11 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2023-06-19 22:07:31 +02:00
|
|
|
@as_json
|
|
|
|
def validation_formsemestre_delete(etudid: int, validation_id: int):
|
2024-07-24 17:34:30 +02:00
|
|
|
"Efface cette validation de semestre."
|
2023-06-19 22:07:31 +02:00
|
|
|
# c'est la même chose (formations classiques)
|
|
|
|
return _validation_ue_delete(etudid, validation_id)
|
|
|
|
|
|
|
|
|
|
|
|
def _validation_ue_delete(etudid: int, validation_id: int):
|
|
|
|
"Efface cette validation (semestres classiques ou UEs)"
|
|
|
|
etud = tools.get_etud(etudid)
|
|
|
|
if etud is None:
|
|
|
|
return "étudiant inconnu", 404
|
|
|
|
validation = ScolarFormSemestreValidation.query.filter_by(
|
|
|
|
id=validation_id, etudid=etudid
|
|
|
|
).first_or_404()
|
2023-06-25 11:49:11 +02:00
|
|
|
# Vérification de la permission:
|
|
|
|
# A le droit de supprimer cette validation: le chef de dept ou quelqu'un ayant
|
|
|
|
# le droit de saisir des décisions de jury dans le formsemestre concerné s'il y en a un
|
|
|
|
# (c'est le cas pour les validations de jury, mais pas pour les "antérieures" non
|
|
|
|
# rattachées à un formsemestre)
|
|
|
|
if not g.scodoc_dept: # accès API
|
2023-09-29 21:17:31 +02:00
|
|
|
if not current_user.has_permission(Permission.EtudInscrit):
|
2023-06-30 17:26:41 +02:00
|
|
|
return json_error(403, "opération non autorisée (117)")
|
2023-06-25 11:49:11 +02:00
|
|
|
else:
|
|
|
|
if validation.formsemestre:
|
|
|
|
if (
|
|
|
|
validation.formsemestre.dept_id != g.scodoc_dept_id
|
|
|
|
) or not validation.formsemestre.can_edit_jury():
|
2023-06-30 17:26:41 +02:00
|
|
|
return json_error(403, "opération non autorisée (123)")
|
2023-09-29 21:17:31 +02:00
|
|
|
elif not current_user.has_permission(Permission.EtudInscrit):
|
2023-06-25 11:49:11 +02:00
|
|
|
# Validation non rattachée à un semestre: on doit être chef
|
2023-06-30 17:26:41 +02:00
|
|
|
return json_error(403, "opération non autorisée (126)")
|
2023-06-25 11:49:11 +02:00
|
|
|
|
2023-06-19 22:07:31 +02:00
|
|
|
log(f"validation_ue_delete: etuid={etudid} {validation}")
|
|
|
|
db.session.delete(validation)
|
|
|
|
sco_cache.invalidate_formsemestre_etud(etud)
|
|
|
|
db.session.commit()
|
2023-06-23 10:37:32 +02:00
|
|
|
_news_delete_jury_etud(etud)
|
2023-06-19 22:07:31 +02:00
|
|
|
return "ok"
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/autorisation_inscription/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/autorisation_inscription/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2023-06-19 22:07:31 +02:00
|
|
|
@as_json
|
|
|
|
def autorisation_inscription_delete(etudid: int, validation_id: int):
|
2024-07-24 17:34:30 +02:00
|
|
|
"Efface cette autorisation d'inscription."
|
2023-06-19 22:07:31 +02:00
|
|
|
etud = tools.get_etud(etudid)
|
|
|
|
if etud is None:
|
|
|
|
return "étudiant inconnu", 404
|
|
|
|
validation = ScolarAutorisationInscription.query.filter_by(
|
|
|
|
id=validation_id, etudid=etudid
|
|
|
|
).first_or_404()
|
|
|
|
log(f"autorisation_inscription_delete: etuid={etudid} {validation}")
|
|
|
|
db.session.delete(validation)
|
|
|
|
sco_cache.invalidate_formsemestre_etud(etud)
|
|
|
|
db.session.commit()
|
2023-06-23 10:37:32 +02:00
|
|
|
_news_delete_jury_etud(etud)
|
2023-06-19 22:07:31 +02:00
|
|
|
return "ok"
|
|
|
|
|
|
|
|
|
2023-07-16 19:59:45 +02:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_rcue/record",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_rcue/record",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2023-07-16 19:59:45 +02:00
|
|
|
@as_json
|
|
|
|
def validation_rcue_record(etudid: int):
|
|
|
|
"""Enregistre une validation de RCUE.
|
2024-07-24 17:34:30 +02:00
|
|
|
|
2023-07-16 19:59:45 +02:00
|
|
|
Si une validation existe déjà pour ce RCUE, la remplace.
|
2024-07-24 17:34:30 +02:00
|
|
|
|
|
|
|
DATA
|
|
|
|
----
|
|
|
|
```json
|
2023-07-16 19:59:45 +02:00
|
|
|
{
|
|
|
|
"code" : str,
|
|
|
|
"ue1_id" : int,
|
|
|
|
"ue2_id" : int,
|
|
|
|
// Optionnel:
|
|
|
|
"formsemestre_id" : int,
|
|
|
|
"date" : date_iso, // si non spécifié, now()
|
|
|
|
"parcours_id" :int,
|
|
|
|
}
|
2024-07-24 17:34:30 +02:00
|
|
|
```
|
2023-07-16 19:59:45 +02:00
|
|
|
"""
|
|
|
|
etud = tools.get_etud(etudid)
|
|
|
|
if etud is None:
|
|
|
|
return json_error(404, "étudiant inconnu")
|
|
|
|
data = request.get_json(force=True) # may raise 400 Bad Request
|
|
|
|
code = data.get("code")
|
|
|
|
if code is None:
|
|
|
|
return json_error(API_CLIENT_ERROR, "missing argument: code")
|
|
|
|
if code not in codes_cursus.CODES_JURY_RCUE:
|
|
|
|
return json_error(API_CLIENT_ERROR, "invalid code value")
|
|
|
|
ue1_id = data.get("ue1_id")
|
|
|
|
if ue1_id is None:
|
|
|
|
return json_error(API_CLIENT_ERROR, "missing argument: ue1_id")
|
|
|
|
try:
|
|
|
|
ue1_id = int(ue1_id)
|
|
|
|
except ValueError:
|
|
|
|
return json_error(API_CLIENT_ERROR, "invalid value for ue1_id")
|
|
|
|
ue2_id = data.get("ue2_id")
|
|
|
|
if ue2_id is None:
|
|
|
|
return json_error(API_CLIENT_ERROR, "missing argument: ue2_id")
|
|
|
|
try:
|
|
|
|
ue2_id = int(ue2_id)
|
|
|
|
except ValueError:
|
|
|
|
return json_error(API_CLIENT_ERROR, "invalid value for ue2_id")
|
|
|
|
formsemestre_id = data.get("formsemestre_id")
|
|
|
|
date_validation_str = data.get("date", datetime.datetime.now().isoformat())
|
|
|
|
parcours_id = data.get("parcours_id")
|
|
|
|
#
|
|
|
|
query = UniteEns.query.filter_by(id=ue1_id)
|
|
|
|
if g.scodoc_dept:
|
|
|
|
query = query.join(Formation).filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
ue1: UniteEns = query.first_or_404()
|
|
|
|
query = UniteEns.query.filter_by(id=ue2_id)
|
|
|
|
if g.scodoc_dept:
|
|
|
|
query = query.join(Formation).filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
ue2: UniteEns = query.first_or_404()
|
|
|
|
if ue1.niveau_competence_id != ue2.niveau_competence_id:
|
|
|
|
return json_error(
|
|
|
|
API_CLIENT_ERROR, "UEs non associees au meme niveau de competence"
|
|
|
|
)
|
|
|
|
if formsemestre_id is not None:
|
|
|
|
query = FormSemestre.query.filter_by(id=formsemestre_id)
|
|
|
|
if g.scodoc_dept:
|
|
|
|
query = query.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
formsemestre: FormSemestre = query.first_or_404()
|
|
|
|
if (formsemestre.formation_id != ue1.formation_id) or (
|
|
|
|
formsemestre.formation_id != ue2.formation_id
|
|
|
|
):
|
|
|
|
return json_error(
|
|
|
|
API_CLIENT_ERROR, "ues et semestre ne sont pas de la meme formation"
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
formsemestre = None
|
|
|
|
try:
|
|
|
|
date_validation = datetime.datetime.fromisoformat(date_validation_str)
|
|
|
|
except ValueError:
|
|
|
|
return json_error(API_CLIENT_ERROR, "invalid date string")
|
|
|
|
if parcours_id is not None:
|
|
|
|
parcours: ApcParcours = ApcParcours.query.get_or_404(parcours_id)
|
|
|
|
if parcours.referentiel_id != ue1.niveau_competence.competence.referentiel_id:
|
|
|
|
return json_error(API_CLIENT_ERROR, "niveau et parcours incompatibles")
|
|
|
|
|
|
|
|
# Une validation pour ce niveau de compétence existe-elle ?
|
|
|
|
validation = (
|
|
|
|
ApcValidationRCUE.query.filter_by(etudid=etudid)
|
|
|
|
.join(UniteEns, UniteEns.id == ApcValidationRCUE.ue2_id)
|
|
|
|
.filter_by(niveau_competence_id=ue2.niveau_competence_id)
|
|
|
|
.first()
|
|
|
|
)
|
|
|
|
if validation:
|
|
|
|
validation.code = code
|
|
|
|
validation.date = date_validation
|
|
|
|
validation.formsemestre_id = formsemestre_id
|
|
|
|
validation.parcours_id = parcours_id
|
|
|
|
validation.ue1_id = ue1_id
|
|
|
|
validation.ue2_id = ue2_id
|
2023-07-18 16:41:02 +02:00
|
|
|
operation = "update"
|
2023-07-16 19:59:45 +02:00
|
|
|
else:
|
|
|
|
validation = ApcValidationRCUE(
|
|
|
|
code=code,
|
|
|
|
date=date_validation,
|
|
|
|
etudid=etudid,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
parcours_id=parcours_id,
|
|
|
|
ue1_id=ue1_id,
|
|
|
|
ue2_id=ue2_id,
|
|
|
|
)
|
2023-07-18 16:41:02 +02:00
|
|
|
operation = "record"
|
2023-07-16 19:59:45 +02:00
|
|
|
db.session.add(validation)
|
2023-07-24 16:48:41 +02:00
|
|
|
# invalider bulletins (les autres résultats ne dépendent pas des RCUEs):
|
|
|
|
sco_cache.invalidate_formsemestre_etud(etud)
|
2023-07-18 16:41:02 +02:00
|
|
|
Scolog.logdb(
|
|
|
|
method="validation_rcue_record",
|
|
|
|
etudid=etudid,
|
|
|
|
msg=f"Enregistrement {validation}",
|
|
|
|
)
|
2024-07-08 23:13:45 +02:00
|
|
|
db.session.commit()
|
2023-07-18 16:41:02 +02:00
|
|
|
log(f"{operation} {validation}")
|
2023-07-16 19:59:45 +02:00
|
|
|
return validation.to_dict()
|
|
|
|
|
|
|
|
|
2023-06-19 22:07:31 +02:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_rcue/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_rcue/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2023-06-19 22:07:31 +02:00
|
|
|
@as_json
|
|
|
|
def validation_rcue_delete(etudid: int, validation_id: int):
|
2024-07-24 17:34:30 +02:00
|
|
|
"Efface cette validation de RCUE."
|
2023-06-19 22:07:31 +02:00
|
|
|
etud = tools.get_etud(etudid)
|
|
|
|
if etud is None:
|
|
|
|
return "étudiant inconnu", 404
|
|
|
|
validation = ApcValidationRCUE.query.filter_by(
|
|
|
|
id=validation_id, etudid=etudid
|
|
|
|
).first_or_404()
|
2024-07-06 23:28:20 +02:00
|
|
|
log(f"delete validation_ue_delete: etuid={etudid} {validation}")
|
2023-06-19 22:07:31 +02:00
|
|
|
db.session.delete(validation)
|
|
|
|
sco_cache.invalidate_formsemestre_etud(etud)
|
|
|
|
db.session.commit()
|
2024-07-06 23:28:20 +02:00
|
|
|
_news_delete_jury_etud(etud, detail="UE")
|
2023-06-19 22:07:31 +02:00
|
|
|
return "ok"
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_annee_but/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_annee_but/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2023-06-19 22:07:31 +02:00
|
|
|
@as_json
|
|
|
|
def validation_annee_but_delete(etudid: int, validation_id: int):
|
2024-07-24 17:34:30 +02:00
|
|
|
"Efface cette validation d'année BUT."
|
2023-06-19 22:07:31 +02:00
|
|
|
etud = tools.get_etud(etudid)
|
|
|
|
if etud is None:
|
|
|
|
return "étudiant inconnu", 404
|
|
|
|
validation = ApcValidationAnnee.query.filter_by(
|
|
|
|
id=validation_id, etudid=etudid
|
|
|
|
).first_or_404()
|
2024-07-06 23:28:20 +02:00
|
|
|
ordre = validation.ordre
|
|
|
|
log(f"delete validation_annee_but: etuid={etudid} {validation}")
|
2023-06-19 22:07:31 +02:00
|
|
|
db.session.delete(validation)
|
|
|
|
sco_cache.invalidate_formsemestre_etud(etud)
|
|
|
|
db.session.commit()
|
2024-07-06 23:28:20 +02:00
|
|
|
_news_delete_jury_etud(etud, detail=f"année BUT{ordre}")
|
|
|
|
return "ok"
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_dut120/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<int:etudid>/jury/validation_dut120/<int:validation_id>/delete",
|
|
|
|
methods=["POST"],
|
|
|
|
)
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.EtudInscrit)
|
|
|
|
@as_json
|
|
|
|
def validation_dut120_delete(etudid: int, validation_id: int):
|
2024-07-24 17:34:30 +02:00
|
|
|
"Efface cette validation de DUT120."
|
2024-07-06 23:28:20 +02:00
|
|
|
etud = tools.get_etud(etudid)
|
|
|
|
if etud is None:
|
|
|
|
return "étudiant inconnu", 404
|
|
|
|
validation = ValidationDUT120.query.filter_by(
|
|
|
|
id=validation_id, etudid=etudid
|
|
|
|
).first_or_404()
|
|
|
|
log(f"delete validation_dut120: etuid={etudid} {validation}")
|
|
|
|
db.session.delete(validation)
|
|
|
|
sco_cache.invalidate_formsemestre_etud(etud)
|
|
|
|
db.session.commit()
|
|
|
|
_news_delete_jury_etud(etud, detail="diplôme DUT120")
|
2023-06-19 22:07:31 +02:00
|
|
|
return "ok"
|