From e1dad774be846c1cda29cb7408f2f5d9bef38803 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 15 Aug 2021 22:41:47 +0200 Subject: [PATCH] fixes --- app/models/formations.py | 2 +- app/views/notes.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/formations.py b/app/models/formations.py index 5c909b2f..25cafe59 100644 --- a/app/models/formations.py +++ b/app/models/formations.py @@ -41,7 +41,7 @@ class NotesUE(db.Model): id = db.Column(db.Integer, primary_key=True) ue_id = db.synonym("id") formation_id = db.Column(db.Integer, db.ForeignKey("notes_formations.id")) - acronyme = db.Column(db.Text()), nullable=False) + acronyme = db.Column(db.Text(), nullable=False) numero = db.Column(db.Integer) # ordre de présentation titre = db.Column(db.Text()) # Type d'UE: 0 normal ("fondamentale"), 1 "sport", 2 "projet et stage (LP)", diff --git a/app/views/notes.py b/app/views/notes.py index 606fa523..91591773 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -1151,10 +1151,20 @@ def formsemestre_enseignants_list(context, REQUEST, formsemestre_id, format="htm cnx = ndb.GetDBConnexion() cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) for ens in sem_ens: + u = User.query.filter_by(id=ens).first() + if not u: + continue cursor.execute( - "select * from scolog L, notes_formsemestre_inscription I where method='AddAbsence' and authenticated_user=%(authenticated_user)s and L.etudid = I.etudid and I.formsemestre_id=%(formsemestre_id)s and date > %(date_debut)s and date < %(date_fin)s", + """SELECT * FROM scolog L, notes_formsemestre_inscription I + WHERE method = 'AddAbsence' + and authenticated_user = %(authenticated_user)s + and L.etudid = I.etudid + and I.formsemestre_id = %(formsemestre_id)s + and date > %(date_debut)s + and date < %(date_fin)s + """, { - "authenticated_user": ens, + "authenticated_user": u.user_name, "formsemestre_id": formsemestre_id, "date_debut": ndb.DateDMYtoISO(sem["date_debut"]), "date_fin": ndb.DateDMYtoISO(sem["date_fin"]),