1
0
forked from ScoDoc/ScoDoc

Liste billest d'absences restreinte au département

This commit is contained in:
Emmanuel Viennet 2021-09-28 09:59:50 +02:00
parent 4728e77a7b
commit 36c22a7ca7
2 changed files with 24 additions and 2 deletions

View File

@ -73,3 +73,17 @@ class BilletAbsence(db.Model):
entry_date = db.Column(db.DateTime(timezone=True), server_default=db.func.now()) entry_date = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
# true si l'absence _pourrait_ etre justifiée # true si l'absence _pourrait_ etre justifiée
justified = db.Column(db.Boolean(), default=False, server_default="false") justified = db.Column(db.Boolean(), default=False, server_default="false")
def to_dict(self):
data = {
"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,
}
return data

View File

@ -72,6 +72,7 @@ from app.decorators import (
from app.views import absences_bp as bp from app.views import absences_bp as bp
# --------------- # ---------------
from app.models.absences import BilletAbsence
from app.scodoc import sco_utils as scu from app.scodoc import sco_utils as scu
from app.scodoc import notesdb as ndb from app.scodoc import notesdb as ndb
from app import log from app import log
@ -1252,8 +1253,15 @@ def XMLgetBilletsEtud(etudid=False):
@scodoc7func @scodoc7func
def listeBillets(): def listeBillets():
"""Page liste des billets non traités et formulaire recherche d'un billet""" """Page liste des billets non traités et formulaire recherche d'un billet"""
cnx = ndb.GetDBConnexion() # utilise Flask, jointure avec departement de l'étudiant
billets = sco_abs.billet_absence_list(cnx, {"etat": False}) billets = (
BilletAbsence.query.filter_by(etat=False)
.join(BilletAbsence.etudiant, aliased=True)
.filter_by(dept_id=g.scodoc_dept_id)
)
# reconverti en dict pour les fonctions scodoc7
billets = [b.to_dict() for b in billets]
#
tab = _tableBillets(billets) tab = _tableBillets(billets)
T = tab.html() T = tab.html()
H = [ H = [