From 72e075530ce137d362058abe3b413d9a745b267f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 16 Sep 2021 22:24:08 +0200 Subject: [PATCH] Pour la transition BUT: bloquage du calcul des moyennes --- app/models/formsemestre.py | 4 ++++ app/scodoc/notes_table.py | 3 +++ app/scodoc/sco_formsemestre.py | 2 ++ app/scodoc/sco_formsemestre_edit.py | 9 ++++++++- app/scodoc/sco_formsemestre_status.py | 9 ++++++--- app/scodoc/sco_preferences.py | 2 +- misc/createtables.sql | 2 +- tests/unit/sco_fake_gen.py | 1 + 8 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 983448c0..89468ab2 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -41,6 +41,10 @@ class FormSemestre(db.Model): bul_hide_xml = db.Column( db.Boolean(), nullable=False, default=False, server_default="false" ) + # Bloque le calcul des moyennes (générale et d'UE) + block_moyennes = db.Column( + db.Boolean(), nullable=False, default=False, server_default="false" + ) # semestres decales (pour gestion jurys): gestion_semestrielle = db.Column( db.Boolean(), nullable=False, default=False, server_default="false" diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index aeb7dabf..bd88cadf 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -186,6 +186,8 @@ class NotesTable(object): self.use_ue_coefs = sco_preferences.get_preference( "use_ue_coefs", formsemestre_id ) + # si vrai, bloque calcul des moy gen. et d'UE.: + self.block_moyennes = self.sem["block_moyennes"] # Infos sur les etudiants self.inscrlist = sco_formsemestre_inscriptions.do_formsemestre_inscription_list( args={"formsemestre_id": formsemestre_id} @@ -738,6 +740,7 @@ class NotesTable(object): block_computation = ( self.inscrdict[etudid]["etat"] == "D" or self.inscrdict[etudid]["etat"] == DEF + or self.block_moyennes ) moy_ues = {} diff --git a/app/scodoc/sco_formsemestre.py b/app/scodoc/sco_formsemestre.py index 65d5d1dd..f519a4ae 100644 --- a/app/scodoc/sco_formsemestre.py +++ b/app/scodoc/sco_formsemestre.py @@ -61,6 +61,7 @@ _formsemestreEditor = ndb.EditableTable( "gestion_semestrielle", "etat", "bul_hide_xml", + "block_moyennes", "bul_bgcolor", "modalite", "resp_can_edit", @@ -81,6 +82,7 @@ _formsemestreEditor = ndb.EditableTable( "etat": bool, "gestion_compensation": bool, "bul_hide_xml": bool, + "block_moyennes": bool, "gestion_semestrielle": bool, "gestion_compensation": bool, "gestion_semestrielle": bool, diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index c1374b10..57740a0f 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -501,6 +501,14 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False): "labels": [""], }, ), + ( + "block_moyennes", + { + "input_type": "boolcheckbox", + "title": "Bloquer moyennes", + "explanation": "empêcher le calcul des moyennes d'UE et générale.", + }, + ), ( "sep", { @@ -693,7 +701,6 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False): tf[2]["bul_hide_xml"] = False else: tf[2]["bul_hide_xml"] = True - # remap les identifiants de responsables: tf[2]["responsable_id"] = User.get_user_id_from_nomplogin( tf[2]["responsable_id"] diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index ab422e53..d54629c9 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -948,10 +948,13 @@ Il y a des notes en attente ! Le classement des étudiants n'a qu'une valeur ind """ ) H.append("") + sem_warning = "" if sem["bul_hide_xml"]: - H.append( - '

Bulletins non publiés sur le portail

' - ) + sem_warning += "Bulletins non publiés sur le portail. " + if sem["block_moyennes"]: + sem_warning += "Calcul des moyennes bloqué !" + if sem_warning: + H.append('

' + sem_warning + "

") if sem["semestre_id"] >= 0 and not sco_formsemestre.sem_une_annee(sem): H.append( '

Attention: ce semestre couvre plusieurs années scolaires !

' diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index e5a27411..779506f1 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -1409,7 +1409,7 @@ class BasePreferences(object): { "initvalue": 1, "title": "Indique si les bulletins sont publiés", - "explanation": "décocher si vous n'avez pas de portal étudiant publiant les bulletins", + "explanation": "décocher si vous n'avez pas de portail étudiant publiant les bulletins", "input_type": "boolcheckbox", "labels": ["non", "oui"], "category": "bul", diff --git a/misc/createtables.sql b/misc/createtables.sql index e5ca1ab7..06001b3a 100644 --- a/misc/createtables.sql +++ b/misc/createtables.sql @@ -1,5 +1,5 @@ --- Creation des tables pour gestion notes +-- Creation des tables pour gestion notes ScoDoc 7 (OBSOLETE !) -- E. Viennet, Sep 2005 diff --git a/tests/unit/sco_fake_gen.py b/tests/unit/sco_fake_gen.py index c2df6738..0ad1453b 100644 --- a/tests/unit/sco_fake_gen.py +++ b/tests/unit/sco_fake_gen.py @@ -219,6 +219,7 @@ class ScoFake(object): etat=None, gestion_compensation=None, bul_hide_xml=None, + block_moyennes=None, gestion_semestrielle=None, bul_bgcolor=None, modalite=NotesFormModalite.DEFAULT_MODALITE,