From 831d14cf7de2aa425672f8fe7547e55f2372f309 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 17 Jan 2022 00:18:08 +0100 Subject: [PATCH] 9.0.25 --- app/scodoc/sco_compute_moy.py | 10 ++++++---- app/scodoc/sco_evaluation_check_abs.py | 6 +++--- app/scodoc/sco_evaluation_db.py | 4 ++-- app/scodoc/sco_liste_notes.py | 12 ++++++------ app/scodoc/sco_saisie_notes.py | 16 ++++++++-------- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/app/scodoc/sco_compute_moy.py b/app/scodoc/sco_compute_moy.py index 85b654549d..b35ca6d421 100644 --- a/app/scodoc/sco_compute_moy.py +++ b/app/scodoc/sco_compute_moy.py @@ -191,6 +191,7 @@ def compute_user_formula( return user_moy +# XXX OBSOLETE def compute_moduleimpl_moyennes(nt, modimpl): """Retourne dict { etudid : note_moyenne } pour tous les etuds inscrits au moduleimpl mod, la liste des evaluations "valides" (toutes notes entrées @@ -228,22 +229,23 @@ def compute_moduleimpl_moyennes(nt, modimpl): user_expr = moduleimpl_has_expression(modimpl) attente = False - # recupere les notes de toutes les evaluations + # récupere les notes de toutes les evaluations eval_rattr = None for e in evals: e["nb_inscrits"] = e["etat"]["nb_inscrits"] - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes( + # XXX OBSOLETE + notes_db = sco_evaluation_db.do_evaluation_get_all_notes( e["evaluation_id"] ) # toutes, y compris demissions # restreint aux étudiants encore inscrits à ce module notes = [ - NotesDB[etudid]["value"] for etudid in NotesDB if (etudid in insmod_set) + notes_db[etudid]["value"] for etudid in notes_db if (etudid in insmod_set) ] e["nb_notes"] = len(notes) e["nb_abs"] = len([x for x in notes if x is None]) e["nb_neutre"] = len([x for x in notes if x == NOTES_NEUTRALISE]) e["nb_att"] = len([x for x in notes if x == NOTES_ATTENTE]) - e["notes"] = NotesDB + e["notes"] = notes_db if e["etat"]["evalattente"]: attente = True diff --git a/app/scodoc/sco_evaluation_check_abs.py b/app/scodoc/sco_evaluation_check_abs.py index 78c18045be..8d52fc4c5f 100644 --- a/app/scodoc/sco_evaluation_check_abs.py +++ b/app/scodoc/sco_evaluation_check_abs.py @@ -85,7 +85,7 @@ def evaluation_check_absences(evaluation_id): Justs = set([x["etudid"] for x in Just]) # ensemble des etudiants avec justif # Les notes: - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) + notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) ValButAbs = [] # une note mais noté absent AbsNonSignalee = [] # note ABS mais pas noté absent ExcNonSignalee = [] # note EXC mais pas noté absent @@ -94,8 +94,8 @@ def evaluation_check_absences(evaluation_id): for etudid, _ in sco_groups.do_evaluation_listeetuds_groups( evaluation_id, getallstudents=True ): - if etudid in NotesDB: - val = NotesDB[etudid]["value"] + if etudid in notes_db: + val = notes_db[etudid]["value"] if ( val != None and val != scu.NOTES_NEUTRALISE and val != scu.NOTES_ATTENTE ) and etudid in As: diff --git a/app/scodoc/sco_evaluation_db.py b/app/scodoc/sco_evaluation_db.py index 36fbb35a6c..17d47915ae 100644 --- a/app/scodoc/sco_evaluation_db.py +++ b/app/scodoc/sco_evaluation_db.py @@ -306,8 +306,8 @@ def do_evaluation_delete(evaluation_id): raise AccessDenied( "Modification évaluation impossible pour %s" % current_user.get_nomplogin() ) - NotesDB = do_evaluation_get_all_notes(evaluation_id) # { etudid : value } - notes = [x["value"] for x in NotesDB.values()] + notes_db = do_evaluation_get_all_notes(evaluation_id) # { etudid : value } + notes = [x["value"] for x in notes_db.values()] if notes: raise ScoValueError( "Impossible de supprimer cette évaluation: il reste des notes" diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index dace96b0ba..4ef37d6816 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -653,11 +653,11 @@ def _add_eval_columns( notes = [] # liste des notes numeriques, pour calcul histogramme uniquement evaluation_id = e["evaluation_id"] e_o = Evaluation.query.get(evaluation_id) # XXX en attendant ré-écriture - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) + notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) for row in rows: etudid = row["etudid"] - if etudid in NotesDB: - val = NotesDB[etudid]["value"] + if etudid in notes_db: + val = notes_db[etudid]["value"] if val is None: nb_abs += 1 if val == scu.NOTES_ATTENTE: @@ -674,12 +674,12 @@ def _add_eval_columns( nb_notes = nb_notes + 1 sum_notes += val val_fmt = scu.fmt_note(val, keep_numeric=keep_numeric) - comment = NotesDB[etudid]["comment"] + comment = notes_db[etudid]["comment"] if comment is None: comment = "" explanation = "%s (%s) %s" % ( - NotesDB[etudid]["date"].strftime("%d/%m/%y %Hh%M"), - sco_users.user_info(NotesDB[etudid]["uid"])["nomcomplet"], + notes_db[etudid]["date"].strftime("%d/%m/%y %Hh%M"), + sco_users.user_info(notes_db[etudid]["uid"])["nomcomplet"], comment, ) else: diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index 7f7012db9f..0fa105db8a 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -308,13 +308,13 @@ def do_evaluation_set_missing(evaluation_id, value, dialog_confirmed=False): # XXX imaginer un redirect + msg erreur raise AccessDenied("Modification des notes impossible pour %s" % current_user) # - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) + notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) etudid_etats = sco_groups.do_evaluation_listeetuds_groups( evaluation_id, getallstudents=True, include_dems=False ) notes = [] for etudid, _ in etudid_etats: # pour tous les inscrits - if etudid not in NotesDB: # pas de note + if etudid not in notes_db: # pas de note notes.append((etudid, value)) # Check value L, invalids, _, _, _ = _check_notes(notes, E, M["module"]) @@ -393,18 +393,18 @@ def evaluation_suppress_alln(evaluation_id, dialog_confirmed=False): ): # On a le droit de modifier toutes les notes # recupere les etuds ayant une note - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) + notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) elif sco_permissions_check.can_edit_notes( current_user, E["moduleimpl_id"], allow_ens=True ): # Enseignant associé au module: ne peut supprimer que les notes qu'il a saisi - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes( + notes_db = sco_evaluation_db.do_evaluation_get_all_notes( evaluation_id, by_uid=current_user.id ) else: raise AccessDenied("Modification des notes impossible pour %s" % current_user) - notes = [(etudid, scu.NOTES_SUPPRESS) for etudid in NotesDB.keys()] + notes = [(etudid, scu.NOTES_SUPPRESS) for etudid in notes_db.keys()] if not dialog_confirmed: nb_changed, nb_suppress, existing_decisions = notes_add( @@ -493,7 +493,7 @@ def notes_add( "etudiant %s: valeur de note invalide (%s)" % (etudid, value) ) # Recherche notes existantes - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) + notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) # Met a jour la base cnx = ndb.GetDBConnexion() cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) @@ -507,7 +507,7 @@ def notes_add( try: for (etudid, value) in notes: changed = False - if etudid not in NotesDB: + if etudid not in notes_db: # nouvelle note if value != scu.NOTES_SUPPRESS: if do_it: @@ -530,7 +530,7 @@ def notes_add( changed = True else: # il y a deja une note - oldval = NotesDB[etudid]["value"] + oldval = notes_db[etudid]["value"] if type(value) != type(oldval): changed = True elif type(value) == type(1.0) and (