Merge branch 'master' of https://scodoc.org/git/viennet/ScoDoc into refactor_nt

This commit is contained in:
Emmanuel Viennet 2022-01-30 08:31:41 +01:00
commit ee2143f6ed
2 changed files with 11 additions and 8 deletions

View File

@ -35,13 +35,15 @@ Created on Thu Sep 8 09:36:33 2016
@author: barasc @author: barasc
""" """
from __future__ import print_function
import os import os
import datetime import datetime
import re import re
import unicodedata import unicodedata
from flask import g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app import log from app import log
from app.scodoc.sco_logos import find_logo from app.scodoc.sco_logos import find_logo
@ -54,7 +56,6 @@ if not PE_DEBUG:
# kw is ignored. log always add a newline # kw is ignored. log always add a newline
log(" ".join(a)) log(" ".join(a))
else: else:
pe_print = print # print function pe_print = print # print function
@ -206,7 +207,9 @@ def add_pe_stuff_to_zip(zipfile, ziproot):
for name in logos_names: for name in logos_names:
logo = find_logo(logoname=name, dept_id=g.scodoc_dept_id) logo = find_logo(logoname=name, dept_id=g.scodoc_dept_id)
if logo is not None: if logo is not None:
add_local_file_to_zip(zipfile, ziproot, logo.filepath, "avis/logos/" + logo.filename) add_local_file_to_zip(
zipfile, ziproot, logo.filepath, "avis/logos/" + logo.filename
)
# ---------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------

View File

@ -567,17 +567,17 @@ def do_etud_inscrit_ue(etudid, formsemestre_id, ue_id):
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
cursor.execute( cursor.execute(
"""SELECT mi.moduleimpl_id """SELECT mi.id
FROM notes_moduleimpl mi, notes_modules mod, notes_formsemestre sem FROM notes_moduleimpl mi, notes_modules mod, notes_formsemestre sem
WHERE sem.formsemestre_id = %(formsemestre_id)s WHERE sem.id = %(formsemestre_id)s
AND mi.formsemestre_id = sem.formsemestre_id AND mi.formsemestre_id = sem.id
AND mod.module_id = mi.module_id AND mod.id = mi.module_id
AND mod.ue_id = %(ue_id)s AND mod.ue_id = %(ue_id)s
""", """,
{"formsemestre_id": formsemestre_id, "ue_id": ue_id}, {"formsemestre_id": formsemestre_id, "ue_id": ue_id},
) )
res = cursor.dictfetchall() res = cursor.dictfetchall()
for moduleimpl_id in [x["moduleimpl_id"] for x in res]: for moduleimpl_id in [x["id"] for x in res]:
sco_moduleimpl.do_moduleimpl_inscription_create( sco_moduleimpl.do_moduleimpl_inscription_create(
{"moduleimpl_id": moduleimpl_id, "etudid": etudid}, {"moduleimpl_id": moduleimpl_id, "etudid": etudid},
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,