forked from ScoDoc/ScoDoc
Efface aussi décisions DUT120 quand on efface toutes les décisions du semestre
This commit is contained in:
parent
34fe649d51
commit
2720fe0b96
@ -82,6 +82,7 @@ from app.models import Evaluation, ModuleImpl, Scolog, ScolarAutorisationInscrip
|
|||||||
from app.models.but_validations import (
|
from app.models.but_validations import (
|
||||||
ApcValidationAnnee,
|
ApcValidationAnnee,
|
||||||
ApcValidationRCUE,
|
ApcValidationRCUE,
|
||||||
|
ValidationDUT120,
|
||||||
)
|
)
|
||||||
from app.models.etudiants import Identite
|
from app.models.etudiants import Identite
|
||||||
from app.models.formations import Formation
|
from app.models.formations import Formation
|
||||||
@ -760,13 +761,13 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
|||||||
self.validation.date = datetime.now()
|
self.validation.date = datetime.now()
|
||||||
|
|
||||||
db.session.add(self.validation)
|
db.session.add(self.validation)
|
||||||
db.session.commit()
|
|
||||||
log(f"Recording {self}: {code}")
|
log(f"Recording {self}: {code}")
|
||||||
Scolog.logdb(
|
Scolog.logdb(
|
||||||
method="jury_but",
|
method="jury_but",
|
||||||
etudid=self.etud.id,
|
etudid=self.etud.id,
|
||||||
msg=f"Validation année BUT{self.annee_but}: {code}",
|
msg=f"Validation année BUT{self.annee_but}: {code}",
|
||||||
)
|
)
|
||||||
|
db.session.commit()
|
||||||
if mark_recorded:
|
if mark_recorded:
|
||||||
self.recorded = True
|
self.recorded = True
|
||||||
self.invalidate_formsemestre_cache()
|
self.invalidate_formsemestre_cache()
|
||||||
@ -903,6 +904,8 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
|||||||
Si only_one_sem, n'efface que les décisions UE et les
|
Si only_one_sem, n'efface que les décisions UE et les
|
||||||
autorisations de passage du semestre d'origine du deca.
|
autorisations de passage du semestre d'origine du deca.
|
||||||
|
|
||||||
|
Efface les validations de DUT120 issues du semestre d'origine du deca.
|
||||||
|
|
||||||
Dans tous les cas, efface les validations de l'année en cours.
|
Dans tous les cas, efface les validations de l'année en cours.
|
||||||
(commite la session.)
|
(commite la session.)
|
||||||
"""
|
"""
|
||||||
@ -952,6 +955,17 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
|||||||
msg=f"Validation année BUT{self.annee_but}: effacée",
|
msg=f"Validation année BUT{self.annee_but}: effacée",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Efface les validations de DUT120 issues du semestre d'origine du deca.
|
||||||
|
for validation in ValidationDUT120.query.filter_by(
|
||||||
|
etudid=self.etud.id, formsemestre_id=self.formsemestre.id
|
||||||
|
):
|
||||||
|
db.session.delete(validation)
|
||||||
|
Scolog.logdb(
|
||||||
|
"jury_but",
|
||||||
|
etudid=self.etud.id,
|
||||||
|
msg="Validation DUT120 effacée",
|
||||||
|
)
|
||||||
|
|
||||||
# Efface éventuelles validations de semestre
|
# Efface éventuelles validations de semestre
|
||||||
# (en principe inutilisées en BUT)
|
# (en principe inutilisées en BUT)
|
||||||
# et autres UEs (en cas de changement d'architecture de formation depuis le jury ?)
|
# et autres UEs (en cas de changement d'architecture de formation depuis le jury ?)
|
||||||
@ -1214,13 +1228,12 @@ class DecisionsProposeesRCUE(DecisionsProposees):
|
|||||||
code=code,
|
code=code,
|
||||||
)
|
)
|
||||||
db.session.add(self.validation)
|
db.session.add(self.validation)
|
||||||
db.session.commit()
|
|
||||||
Scolog.logdb(
|
Scolog.logdb(
|
||||||
method="jury_but",
|
method="jury_but",
|
||||||
etudid=self.etud.id,
|
etudid=self.etud.id,
|
||||||
msg=f"Validation {self.rcue}: {code}",
|
msg=f"Validation {self.rcue}: {code}",
|
||||||
commit=True,
|
|
||||||
)
|
)
|
||||||
|
db.session.commit()
|
||||||
log(f"rcue.record {self}: {code}")
|
log(f"rcue.record {self}: {code}")
|
||||||
|
|
||||||
# Modifie au besoin les codes d'UE
|
# Modifie au besoin les codes d'UE
|
||||||
@ -1633,13 +1646,12 @@ class DecisionsProposeesUE(DecisionsProposees):
|
|||||||
moy_ue=self.moy_ue,
|
moy_ue=self.moy_ue,
|
||||||
)
|
)
|
||||||
db.session.add(self.validation)
|
db.session.add(self.validation)
|
||||||
db.session.commit()
|
|
||||||
Scolog.logdb(
|
Scolog.logdb(
|
||||||
method="jury_but",
|
method="jury_but",
|
||||||
etudid=self.etud.id,
|
etudid=self.etud.id,
|
||||||
msg=f"Validation UE {self.ue.id} {self.ue.acronyme}({self.moy_ue}): {code}",
|
msg=f"Validation UE {self.ue.id} {self.ue.acronyme}({self.moy_ue}): {code}",
|
||||||
commit=True,
|
|
||||||
)
|
)
|
||||||
|
db.session.commit()
|
||||||
log(f"DecisionsProposeesUE: recording {self.validation}")
|
log(f"DecisionsProposeesUE: recording {self.validation}")
|
||||||
|
|
||||||
sco_cache.invalidate_formsemestre(formsemestre_id=self.formsemestre.id)
|
sco_cache.invalidate_formsemestre(formsemestre_id=self.formsemestre.id)
|
||||||
|
@ -18,9 +18,7 @@ from wtforms import SubmitField
|
|||||||
from app import db, log
|
from app import db, log
|
||||||
from app.but import cursus_but
|
from app.but import cursus_but
|
||||||
from app.decorators import scodoc, permission_required
|
from app.decorators import scodoc, permission_required
|
||||||
from app.models.but_validations import ValidationDUT120
|
from app.models import FormSemestre, Identite, Scolog, ValidationDUT120
|
||||||
from app.models.etudiants import Identite
|
|
||||||
from app.models.formsemestre import FormSemestre
|
|
||||||
from app.scodoc.sco_exceptions import ScoPermissionDenied, ScoValueError
|
from app.scodoc.sco_exceptions import ScoPermissionDenied, ScoValueError
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.views import notes_bp as bp
|
from app.views import notes_bp as bp
|
||||||
@ -71,7 +69,7 @@ def validate_dut120_etud(etudid: int, formsemestre_id: int):
|
|||||||
form = ValidationDUT120Form()
|
form = ValidationDUT120Form()
|
||||||
# Check if ValidationDUT120 instance already exists
|
# Check if ValidationDUT120 instance already exists
|
||||||
existing_validation = ValidationDUT120.query.filter_by(
|
existing_validation = ValidationDUT120.query.filter_by(
|
||||||
etudid=etudid, referentiel_competence_id=refcomp.id
|
etudid=etud.id, referentiel_competence_id=refcomp.id
|
||||||
).first()
|
).first()
|
||||||
if existing_validation:
|
if existing_validation:
|
||||||
flash("DUT120 déjà validé", "info")
|
flash("DUT120 déjà validé", "info")
|
||||||
@ -85,11 +83,16 @@ def validate_dut120_etud(etudid: int, formsemestre_id: int):
|
|||||||
|
|
||||||
if etud_can_validate_dut and request.method == "POST" and form.validate_on_submit():
|
if etud_can_validate_dut and request.method == "POST" and form.validate_on_submit():
|
||||||
new_validation = ValidationDUT120(
|
new_validation = ValidationDUT120(
|
||||||
etudid=etudid,
|
etudid=etud.id,
|
||||||
referentiel_competence_id=refcomp.id,
|
referentiel_competence_id=refcomp.id,
|
||||||
formsemestre_id=formsemestre.id, # Replace with appropriate value
|
formsemestre_id=formsemestre.id, # Replace with appropriate value
|
||||||
)
|
)
|
||||||
db.session.add(new_validation)
|
db.session.add(new_validation)
|
||||||
|
Scolog.logdb(
|
||||||
|
"jury_but",
|
||||||
|
etudid=etud.id,
|
||||||
|
msg=f"Validation DUT120 enregistrée depuis S{formsemestre.semestre_id}",
|
||||||
|
)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
log(f"ValidationDUT120 enregistrée pour {etud} depuis {formsemestre}")
|
log(f"ValidationDUT120 enregistrée pour {etud} depuis {formsemestre}")
|
||||||
flash("Validation DUT120 enregistrée", "success")
|
flash("Validation DUT120 enregistrée", "success")
|
||||||
|
@ -186,7 +186,7 @@ class ScolarAutorisationInscription(db.Model):
|
|||||||
origin_formsemestre_id: int,
|
origin_formsemestre_id: int,
|
||||||
semestre_id: int,
|
semestre_id: int,
|
||||||
):
|
):
|
||||||
"""Ajoute une autorisation"""
|
"""Ajoute une autorisation (don't commit)"""
|
||||||
autorisation = cls(
|
autorisation = cls(
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
formation_code=formation_code,
|
formation_code=formation_code,
|
||||||
|
Loading…
Reference in New Issue
Block a user