From 41adb1953ef45d15b72c46cfc6a95805de78e80a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 10 Feb 2022 18:49:25 +0100 Subject: [PATCH 1/2] Close #201 --- app/but/bulletin_but.py | 7 ++++++- app/forms/main/config_logos.py | 4 ++-- app/scodoc/notes_table.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 2f1637fbb..5b17c814a 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -153,7 +153,12 @@ class BulletinBUT: self.etud_eval_results(etud, e) for e in modimpl.evaluations if e.visibulletin - and modimpl_results.evaluations_etat[e.id].is_complete + and ( + modimpl_results.evaluations_etat[e.id].is_complete + or sco_preferences.get_preference( + "bul_show_all_evals", res.formsemestre.id + ) + ) ], } return d diff --git a/app/forms/main/config_logos.py b/app/forms/main/config_logos.py index 91a73747a..2be78713d 100644 --- a/app/forms/main/config_logos.py +++ b/app/forms/main/config_logos.py @@ -119,9 +119,9 @@ class AddLogoForm(FlaskForm): label="Nom", validators=[ validators.regexp( - r"^[a-zA-Z0-9-]*$", + r"^[a-zA-Z0-9-_]*$", re.IGNORECASE, - "Ne doit comporter que lettres, chiffres ou -", + "Ne doit comporter que lettres, chiffres, _ ou -", ), validators.Length( max=20, message="Un nom ne doit pas dépasser 20 caractères" diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index a9aaf7e16..d014d9faf 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -171,7 +171,7 @@ class NotesTable: def __init__(self, formsemestre_id): # log(f"NotesTable( formsemestre_id={formsemestre_id} )") - raise NotImplementedError() # XXX + # raise NotImplementedError() # XXX if not formsemestre_id: raise ValueError("invalid formsemestre_id (%s)" % formsemestre_id) self.formsemestre_id = formsemestre_id From 95b7c1c33cffb41608475ccb6d67e7cd4f35b8ae Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 10 Feb 2022 21:09:45 +0100 Subject: [PATCH 2/2] Closes #229 --- app/scodoc/sco_evaluation_edit.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/scodoc/sco_evaluation_edit.py b/app/scodoc/sco_evaluation_edit.py index 2f5efbc4e..5b41941cd 100644 --- a/app/scodoc/sco_evaluation_edit.py +++ b/app/scodoc/sco_evaluation_edit.py @@ -139,6 +139,7 @@ def evaluation_create_form( initvalues["visibulletinlist"] = ["X"] else: initvalues["visibulletinlist"] = [] + initvalues["coefficient"] = initvalues.get("coefficient", 1.0) vals = scu.get_request_args() if vals.get("tf_submitted", False) and "visibulletinlist" not in vals: vals["visibulletinlist"] = [] @@ -158,7 +159,7 @@ def evaluation_create_form( else: coef_ue = ue_coef_dict.get(ue.id, 0.0) or 0.0 if coef_ue > 0: - poids = 1.0 # par defaut au départ + poids = 1.0 # par défaut au départ else: poids = 0.0 initvalues[f"poids_{ue.id}"] = poids @@ -284,6 +285,7 @@ def evaluation_create_form( ] # Liste des UE utilisées dans des modules de ce semestre: for ue in sem_ues: + coef_ue = ue_coef_dict.get(ue.id, 0.0) form.append( ( f"poids_{ue.id}", @@ -292,10 +294,14 @@ def evaluation_create_form( "size": 2, "type": "float", "explanation": f""" - {ue_coef_dict.get(ue.id, 0.)} + ({"coef. mod.:" +str(coef_ue) if coef_ue else "ce module n'a pas de coef. dans cette UE"}) {ue.titre} """, "allow_null": False, + # ok si poids nul ou coef vers l'UE nul: + "validator": lambda val, field: (not val) + or ue_coef_dict.get(int(field[len("poids_") :]), 0.0) != 0, + "enabled": coef_ue != 0 or initvalues[f"poids_{ue.id}"] != 0.0, }, ), ) @@ -331,7 +337,7 @@ def evaluation_create_form( if edit: sco_evaluation_db.do_evaluation_edit(tf[2]) else: - # creation d'une evaluation + # création d'une evaluation evaluation_id = sco_evaluation_db.do_evaluation_create(**tf[2]) if is_apc: # Set poids