forked from ScoDoc/ScoDoc
Fix: supprimer assiduite et justificatif: commits manquants
This commit is contained in:
parent
152fca5748
commit
ec4aed584f
@ -3,7 +3,9 @@
|
||||
"""
|
||||
from datetime import datetime
|
||||
|
||||
from app import db, log, g
|
||||
from flask_sqlalchemy.query import Query
|
||||
|
||||
from app import db, log, g, set_sco_dept
|
||||
from app.models import ModuleImpl, Module, Scolog, FormSemestre, FormSemestreInscription
|
||||
from app.models.etudiants import Identite
|
||||
from app.auth.models import User
|
||||
@ -16,8 +18,6 @@ from app.scodoc.sco_utils import (
|
||||
is_assiduites_module_forced,
|
||||
)
|
||||
|
||||
from flask_sqlalchemy.query import Query
|
||||
|
||||
|
||||
class Assiduite(db.Model):
|
||||
"""
|
||||
@ -80,7 +80,7 @@ class Assiduite(db.Model):
|
||||
def to_dict(self, format_api=True) -> dict:
|
||||
"""Retourne la représentation json de l'assiduité"""
|
||||
etat = self.etat
|
||||
user: User = None
|
||||
user: User | None = None
|
||||
if format_api:
|
||||
# format api utilise les noms "present,absent,retard" au lieu des int
|
||||
etat = EtatAssiduite.inverse().get(self.etat).name
|
||||
@ -252,11 +252,12 @@ class Assiduite(db.Model):
|
||||
# Suppression de l'objet et LOG
|
||||
log(f"delete_assidutite: {self.etudiant.id} {self}")
|
||||
Scolog.logdb(
|
||||
method=f"delete_assiduite",
|
||||
method="delete_assiduite",
|
||||
etudid=self.etudiant.id,
|
||||
msg=f"Assiduité: {self}",
|
||||
)
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
# Invalidation du cache
|
||||
scass.simple_invalidate_cache(obj_dict)
|
||||
|
||||
@ -437,6 +438,7 @@ class Justificatif(db.Model):
|
||||
msg=f"Justificatif: {self}",
|
||||
)
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
# On actualise les assiduités justifiées de l'étudiant concerné
|
||||
compute_assiduites_justified(
|
||||
self.etudid,
|
||||
|
Loading…
Reference in New Issue
Block a user