Fix: exc. inscriptions en doublon, bul xml compat but

This commit is contained in:
Emmanuel Viennet 2022-02-14 13:55:07 +01:00
parent bc621d8443
commit 37fde88a74
2 changed files with 23 additions and 11 deletions

View File

@ -220,6 +220,7 @@ def bulletin_but_xml_compat(
note_max_origin=str(e.note_max),
)
x_mod.append(x_eval)
try:
x_eval.append(
Element(
"note",
@ -231,6 +232,11 @@ def bulletin_but_xml_compat(
),
)
)
except KeyError:
x_eval.append(
Element("note", value="", note_max="")
)
# XXX TODO: Evaluations incomplètes ou futures: XXX
# XXX TODO UE capitalisee (listee seulement si meilleure que l'UE courante)

View File

@ -29,6 +29,7 @@
"""
from flask_login import current_user
import psycopg2
import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb
@ -271,7 +272,12 @@ _moduleimpl_inscriptionEditor = ndb.EditableTable(
def do_moduleimpl_inscription_create(args, formsemestre_id=None):
"create a moduleimpl_inscription"
cnx = ndb.GetDBConnexion()
try:
r = _moduleimpl_inscriptionEditor.create(cnx, args)
except psycopg2.errors.UniqueViolation as exc:
raise ScoValueError(
"Inscription impossible car déjà existante: vérifiez la situation"
)
sco_cache.invalidate_formsemestre(
formsemestre_id=formsemestre_id
) # > moduleimpl_inscription