2021-08-07 15:20:30 +02:00
|
|
|
# -*- coding: UTF-8 -*
|
|
|
|
|
|
|
|
"""Gestion des absences
|
|
|
|
"""
|
|
|
|
|
|
|
|
from app import db
|
|
|
|
|
|
|
|
|
|
|
|
class Absence(db.Model):
|
2024-07-19 09:42:44 +02:00
|
|
|
"""LEGACY
|
|
|
|
Ce modèle n'est PLUS UTILISE depuis ScoDoc 9.6 et remplacé par assiduité.
|
|
|
|
une absence (sur une demi-journée)
|
|
|
|
"""
|
2021-08-07 15:20:30 +02:00
|
|
|
|
|
|
|
__tablename__ = "absences"
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
2022-05-26 03:55:03 +02:00
|
|
|
etudid = db.Column(
|
|
|
|
db.Integer, db.ForeignKey("identite.id", ondelete="CASCADE"), index=True
|
|
|
|
)
|
2021-08-07 15:20:30 +02:00
|
|
|
jour = db.Column(db.Date)
|
|
|
|
estabs = db.Column(db.Boolean())
|
|
|
|
estjust = db.Column(db.Boolean())
|
|
|
|
matin = db.Column(db.Boolean())
|
|
|
|
# motif de l'absence:
|
|
|
|
description = db.Column(db.Text())
|
|
|
|
entry_date = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
|
|
|
# moduleimpid concerne (optionnel):
|
|
|
|
moduleimpl_id = db.Column(
|
|
|
|
db.Integer,
|
2023-03-15 19:13:45 +01:00
|
|
|
db.ForeignKey("notes_moduleimpl.id", ondelete="SET NULL"),
|
2021-08-07 15:20:30 +02:00
|
|
|
)
|
|
|
|
|
2022-04-25 15:25:45 +02:00
|
|
|
def to_dict(self):
|
|
|
|
data = {
|
|
|
|
"id": self.id,
|
|
|
|
"etudid": self.etudid,
|
|
|
|
"jour": self.jour,
|
|
|
|
"estabs": self.estabs,
|
|
|
|
"estjust": self.estjust,
|
|
|
|
"matin": self.matin,
|
|
|
|
"description": self.description,
|
|
|
|
"entry_date": self.entry_date,
|
|
|
|
"moduleimpl_id": self.moduleimpl_id,
|
|
|
|
}
|
|
|
|
return data
|
|
|
|
|
2021-08-07 15:20:30 +02:00
|
|
|
|
|
|
|
class AbsenceNotification(db.Model):
|
|
|
|
"""Notification d'absence émise"""
|
|
|
|
|
|
|
|
__tablename__ = "absences_notifications"
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
etudid = db.Column(
|
|
|
|
db.Integer,
|
2022-05-26 03:55:03 +02:00
|
|
|
db.ForeignKey("identite.id", ondelete="CASCADE"),
|
2021-08-07 15:20:30 +02:00
|
|
|
)
|
|
|
|
notification_date = db.Column(
|
|
|
|
db.DateTime(timezone=True), server_default=db.func.now()
|
|
|
|
)
|
|
|
|
email = db.Column(db.Text())
|
|
|
|
nbabs = db.Column(db.Integer)
|
|
|
|
nbabsjust = db.Column(db.Integer)
|
|
|
|
formsemestre_id = db.Column(
|
|
|
|
db.Integer,
|
2021-11-09 11:52:41 +01:00
|
|
|
db.ForeignKey("notes_formsemestre.id", ondelete="CASCADE"),
|
2021-08-07 15:20:30 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class BilletAbsence(db.Model):
|
|
|
|
"""Billet d'absence (signalement par l'étudiant)"""
|
|
|
|
|
|
|
|
__tablename__ = "billet_absence"
|
|
|
|
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
etudid = db.Column(
|
|
|
|
db.Integer,
|
|
|
|
db.ForeignKey("identite.id"),
|
|
|
|
index=True,
|
|
|
|
)
|
|
|
|
abs_begin = db.Column(db.DateTime(timezone=True))
|
|
|
|
abs_end = db.Column(db.DateTime(timezone=True))
|
|
|
|
# raison de l'absence:
|
|
|
|
description = db.Column(db.Text())
|
|
|
|
# False: new, True: processed
|
2021-08-10 00:23:30 +02:00
|
|
|
etat = db.Column(db.Boolean(), default=False, server_default="false")
|
2021-08-07 15:20:30 +02:00
|
|
|
entry_date = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
|
|
|
# true si l'absence _pourrait_ etre justifiée
|
2021-08-10 00:23:30 +02:00
|
|
|
justified = db.Column(db.Boolean(), default=False, server_default="false")
|
2021-09-28 09:59:50 +02:00
|
|
|
|
|
|
|
def to_dict(self):
|
2022-08-01 21:42:19 +02:00
|
|
|
return {
|
2021-09-28 09:59:50 +02:00
|
|
|
"id": self.id,
|
|
|
|
"billet_id": self.id,
|
|
|
|
"etudid": self.etudid,
|
|
|
|
"abs_begin": self.abs_begin,
|
|
|
|
"abs_end": self.abs_begin,
|
|
|
|
"description": self.description,
|
|
|
|
"etat": self.etat,
|
|
|
|
"entry_date": self.entry_date,
|
|
|
|
"justified": self.justified,
|
|
|
|
}
|