Fix: enregistrement des RCUEs antérieurs

This commit is contained in:
Emmanuel Viennet 2023-07-18 16:41:02 +02:00
parent f414ec1c0d
commit 0573081711
5 changed files with 16 additions and 16 deletions

View File

@ -269,13 +269,7 @@ def validation_rcue_record(etudid: int):
validation.parcours_id = parcours_id validation.parcours_id = parcours_id
validation.ue1_id = ue1_id validation.ue1_id = ue1_id
validation.ue2_id = ue2_id validation.ue2_id = ue2_id
log(f"updating {validation}") operation = "update"
Scolog.logdb(
method="validation_rcue_record",
etudid=etudid,
msg=f"Mise à jour {validation}",
commit=False,
)
else: else:
validation = ApcValidationRCUE( validation = ApcValidationRCUE(
code=code, code=code,
@ -286,15 +280,16 @@ def validation_rcue_record(etudid: int):
ue1_id=ue1_id, ue1_id=ue1_id,
ue2_id=ue2_id, ue2_id=ue2_id,
) )
log(f"recording {validation}") operation = "record"
db.session.add(validation)
db.session.commit()
Scolog.logdb( Scolog.logdb(
method="validation_rcue_record", method="validation_rcue_record",
etudid=etudid, etudid=etudid,
msg=f"Enregistrement {validation}", msg=f"Enregistrement {validation}",
commit=False, commit=True,
) )
db.session.add(validation) log(f"{operation} {validation}")
db.session.commit()
return validation.to_dict() return validation.to_dict()

View File

@ -82,6 +82,10 @@ class ApcValidationRCUE(db.Model):
"as a dict" "as a dict"
d = dict(self.__dict__) d = dict(self.__dict__)
d.pop("_sa_instance_state", None) d.pop("_sa_instance_state", None)
d["etud"] = self.etud.to_dict_short()
d["ue1"] = self.ue1.to_dict()
d["ue2"] = self.ue2.to_dict()
return d return d
def to_dict_bul(self) -> dict: def to_dict_bul(self) -> dict:

View File

@ -517,7 +517,7 @@ def ficheEtud(etudid=None):
cursus=but_cursus, cursus=but_cursus,
scu=scu, scu=scu,
)} )}
<div> <div class="link_validation_rcues">
<a href="{url_for("notes.validation_rcues", <a href="{url_for("notes.validation_rcues",
scodoc_dept=g.scodoc_dept, etudid=etudid, scodoc_dept=g.scodoc_dept, etudid=etudid,
formsemestre_id=last_formsemestre.id)}" formsemestre_id=last_formsemestre.id)}"

View File

@ -100,6 +100,7 @@
data-ue2_id="{{niv['ue_pair'].id}}" data-ue2_id="{{niv['ue_pair'].id}}"
data-code="{{validation.code if validation else ''}}" data-code="{{validation.code if validation else ''}}"
> >
<option value="" disabled {{"selected" if not validation else ""}}>-</option>
{% for code in rcue_codes %} {% for code in rcue_codes %}
<option value="{{code}}" <option value="{{code}}"
{% if validation and validation.code == code -%} {% if validation and validation.code == code -%}

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.5.5" SCOVERSION = "9.5.6"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"