From 6596e70eecaae5942e0c494b6c7f734c3c3c0fa3 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 17 Dec 2021 23:50:34 +0100 Subject: [PATCH] =?UTF-8?q?Affichage=20des=20notes=20d'=C3=A9valuation=20d?= =?UTF-8?q?ans=20tableau=20de=20bord=20module=20(prise=20en=20compte=20des?= =?UTF-8?q?=20(de)inscriptions).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_evaluations.py | 58 +++++++++++---------- app/scodoc/sco_formsemestre_inscriptions.py | 4 +- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index ab6cdf6f..7d6bb82b 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -109,30 +109,10 @@ def do_evaluation_etat(evaluation_id, partition_id=None, select_first_partition= nb_inscrits = len( sco_groups.do_evaluation_listeetuds_groups(evaluation_id, getallstudents=True) ) - NotesDB = sco_evaluation_db.do_evaluation_get_all_notes( + etuds_notes_dict = sco_evaluation_db.do_evaluation_get_all_notes( evaluation_id - ) # { etudid : value } - notes = [x["value"] for x in NotesDB.values()] - nb_abs = len([x for x in notes if x is None]) - nb_neutre = len([x for x in notes if x == scu.NOTES_NEUTRALISE]) - nb_att = len([x for x in notes if x == scu.NOTES_ATTENTE]) - moy_num, median_num, mini_num, maxi_num = notes_moyenne_median_mini_maxi(notes) - if moy_num is None: - median, moy = "", "" - median_num, moy_num = None, None - mini, maxi = "", "" - mini_num, maxi_num = None, None - else: - median = scu.fmt_note(median_num) - moy = scu.fmt_note(moy_num) - mini = scu.fmt_note(mini_num) - maxi = scu.fmt_note(maxi_num) - # cherche date derniere modif note - if len(NotesDB): - t = [x["date"] for x in NotesDB.values()] - last_modif = max(t) - else: - last_modif = None + ) # { etudid : note } + # ---- Liste des groupes complets et incomplets E = sco_evaluation_db.do_evaluation_list(args={"evaluation_id": evaluation_id})[0] M = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0] @@ -163,8 +143,32 @@ def do_evaluation_etat(evaluation_id, partition_id=None, select_first_partition= # Nombre de notes valides d'étudiants inscrits au module # (car il peut y avoir des notes d'étudiants désinscrits depuis l'évaluation) - nb_notes = len(insmodset.intersection(NotesDB)) - nb_notes_total = len(NotesDB) + etudids_avec_note = insmodset.intersection(etuds_notes_dict) + nb_notes = len(etudids_avec_note) + # toutes saisies, y compris chez des non-inscrits: + nb_notes_total = len(etuds_notes_dict) + + notes = [etuds_notes_dict[etudid]["value"] for etudid in etudids_avec_note] + nb_abs = len([x for x in notes if x is None]) + nb_neutre = len([x for x in notes if x == scu.NOTES_NEUTRALISE]) + nb_att = len([x for x in notes if x == scu.NOTES_ATTENTE]) + moy_num, median_num, mini_num, maxi_num = notes_moyenne_median_mini_maxi(notes) + if moy_num is None: + median, moy = "", "" + median_num, moy_num = None, None + mini, maxi = "", "" + mini_num, maxi_num = None, None + else: + median = scu.fmt_note(median_num) + moy = scu.fmt_note(moy_num) + mini = scu.fmt_note(mini_num) + maxi = scu.fmt_note(maxi_num) + # cherche date derniere modif note + if len(etuds_notes_dict): + t = [x["date"] for x in etuds_notes_dict.values()] + last_modif = max(t) + else: + last_modif = None # On considere une note "manquante" lorsqu'elle n'existe pas # ou qu'elle est en attente (ATT) @@ -181,8 +185,8 @@ def do_evaluation_etat(evaluation_id, partition_id=None, select_first_partition= groups[group["group_id"]] = group # isMissing = False - if i["etudid"] in NotesDB: - val = NotesDB[i["etudid"]]["value"] + if i["etudid"] in etuds_notes_dict: + val = etuds_notes_dict[i["etudid"]]["value"] if val == scu.NOTES_ATTENTE: isMissing = True TotalNbAtt += 1 diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 20ffa7a9..30cbec83 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -66,7 +66,9 @@ def do_formsemestre_inscription_list(*args, **kw): def do_formsemestre_inscription_listinscrits(formsemestre_id): - """Liste les inscrits (état I) à ce semestre et cache le résultat""" + """Liste les inscrits (état I) à ce semestre et cache le résultat. + Result: [ { "etudid":, "formsemestre_id": , "etat": , "etape": }] + """ r = sco_cache.SemInscriptionsCache.get(formsemestre_id) if r is None: # retreive list