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

This commit is contained in:
Emmanuel Viennet 2022-01-27 10:23:56 +01:00
commit cc6ec2416c
6 changed files with 18 additions and 9 deletions

View File

@ -206,7 +206,7 @@ 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, "avis/logos/" + logo.filename) add_local_file_to_zip(zipfile, ziproot, logo.filepath, "avis/logos/" + logo.filename)
# ---------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------

View File

@ -97,7 +97,7 @@ def pe_view_sem_recap(
template_latex = "" template_latex = ""
# template fourni via le formulaire Web # template fourni via le formulaire Web
if avis_tmpl_file: if avis_tmpl_file:
template_latex = avis_tmpl_file.read() template_latex = avis_tmpl_file.read().decode('utf-8')
template_latex = template_latex template_latex = template_latex
else: else:
# template indiqué dans préférences ScoDoc ? # template indiqué dans préférences ScoDoc ?
@ -114,7 +114,7 @@ def pe_view_sem_recap(
footer_latex = "" footer_latex = ""
# template fourni via le formulaire Web # template fourni via le formulaire Web
if footer_tmpl_file: if footer_tmpl_file:
footer_latex = footer_tmpl_file.read() footer_latex = footer_tmpl_file.read().decode('utf-8')
footer_latex = footer_latex footer_latex = footer_latex
else: else:
footer_latex = pe_avislatex.get_code_latex_from_scodoc_preference( footer_latex = pe_avislatex.get_code_latex_from_scodoc_preference(

View File

@ -33,13 +33,15 @@ from flask import url_for, render_template
from flask import g, request from flask import g, request
from flask_login import current_user from flask_login import current_user
from app import db
from app import log
from app.models import APO_CODE_STR_LEN from app.models import APO_CODE_STR_LEN
from app.models import Formation, UniteEns, ModuleImpl, Module from app.models import Formation, UniteEns, ModuleImpl, Module
from app.models.formations import Matiere
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.sco_utils import ModuleType from app.scodoc.sco_utils import ModuleType
from app import log from app.scodoc.TrivialFormulator import TrivialFormulator
from app.scodoc.TrivialFormulator import TrivialFormulator, TF
from app.scodoc.gen_tables import GenTable from app.scodoc.gen_tables import GenTable
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import ( from app.scodoc.sco_exceptions import (
@ -542,6 +544,12 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list
# pour faciliter la transition des anciens programmes non APC # pour faciliter la transition des anciens programmes non APC
for ue in ues_obj: for ue in ues_obj:
ue.guess_semestre_idx() ue.guess_semestre_idx()
# vérifie qu'on a bien au moins une matière dans chaque UE
for ue in ues_obj:
if ue.matieres.count() < 1:
mat = Matiere(ue_id=ue.id)
db.session.add(mat)
db.session.commit()
ues = [ue.to_dict() for ue in ues_obj] ues = [ue.to_dict() for ue in ues_obj]
ues_externes = [ue.to_dict() for ue in ues_externes_obj] ues_externes = [ue.to_dict() for ue in ues_externes_obj]

View File

@ -185,7 +185,8 @@ def _check_evaluation_args(args):
if (jour > date_fin) or (jour < date_debut): if (jour > date_fin) or (jour < date_debut):
raise ScoValueError( raise ScoValueError(
"La date de l'évaluation (%s/%s/%s) n'est pas dans le semestre !" "La date de l'évaluation (%s/%s/%s) n'est pas dans le semestre !"
% (d, m, y) % (d, m, y),
dest_url="javascript:history.back();",
) )
heure_debut = args.get("heure_debut", None) heure_debut = args.get("heure_debut", None)
args["heure_debut"] = heure_debut args["heure_debut"] = heure_debut

View File

@ -40,7 +40,7 @@ class InvalidNoteValue(ScoException):
pass pass
# Exception qui stoque dest_url, utilisee dans Zope standard_error_message # Exception qui stoque dest_url
class ScoValueError(ScoException): class ScoValueError(ScoException):
def __init__(self, msg, dest_url=None): def __init__(self, msg, dest_url=None):
super().__init__(msg) super().__init__(msg)

View File

@ -108,10 +108,10 @@ def _build_menu_stats(formsemestre_id):
"enabled": True, "enabled": True,
}, },
{ {
"title": "Documents Avis Poursuite Etudes", "title": "Documents Avis Poursuite Etudes (xp)",
"endpoint": "notes.pe_view_sem_recap", "endpoint": "notes.pe_view_sem_recap",
"args": {"formsemestre_id": formsemestre_id}, "args": {"formsemestre_id": formsemestre_id},
"enabled": current_app.config["TESTING"] or current_app.config["DEBUG"], "enabled": True, # current_app.config["TESTING"] or current_app.config["DEBUG"],
}, },
{ {
"title": 'Table "débouchés"', "title": 'Table "débouchés"',