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,17 +220,23 @@ def bulletin_but_xml_compat(
note_max_origin=str(e.note_max), note_max_origin=str(e.note_max),
) )
x_mod.append(x_eval) x_mod.append(x_eval)
x_eval.append( try:
Element( x_eval.append(
"note", Element(
value=scu.fmt_note( "note",
results.modimpls_results[ value=scu.fmt_note(
e.moduleimpl_id results.modimpls_results[
].evals_notes[e.id][etud.id], e.moduleimpl_id
note_max=e.note_max, ].evals_notes[e.id][etud.id],
), note_max=e.note_max,
),
)
) )
) except KeyError:
x_eval.append(
Element("note", value="", note_max="")
)
# XXX TODO: Evaluations incomplètes ou futures: XXX # XXX TODO: Evaluations incomplètes ou futures: XXX
# XXX TODO UE capitalisee (listee seulement si meilleure que l'UE courante) # XXX TODO UE capitalisee (listee seulement si meilleure que l'UE courante)

View File

@ -29,6 +29,7 @@
""" """
from flask_login import current_user from flask_login import current_user
import psycopg2
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
@ -271,7 +272,12 @@ _moduleimpl_inscriptionEditor = ndb.EditableTable(
def do_moduleimpl_inscription_create(args, formsemestre_id=None): def do_moduleimpl_inscription_create(args, formsemestre_id=None):
"create a moduleimpl_inscription" "create a moduleimpl_inscription"
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
r = _moduleimpl_inscriptionEditor.create(cnx, args) 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( sco_cache.invalidate_formsemestre(
formsemestre_id=formsemestre_id formsemestre_id=formsemestre_id
) # > moduleimpl_inscription ) # > moduleimpl_inscription