From 072f8b09de88e9ea3b18dab9e384dd81056119f0 Mon Sep 17 00:00:00 2001 From: viennet Date: Mon, 30 Nov 2020 00:11:39 +0100 Subject: [PATCH] Statistiques: selection par annee de bac --- misc/change_etudid.py | 0 sco_report.py | 100 +++++++++++++++++++++++++++++------------- 2 files changed, 69 insertions(+), 31 deletions(-) mode change 100755 => 100644 misc/change_etudid.py diff --git a/misc/change_etudid.py b/misc/change_etudid.py old mode 100755 new mode 100644 diff --git a/sco_report.py b/sco_report.py index 1f21f109..09669127 100644 --- a/sco_report.py +++ b/sco_report.py @@ -50,8 +50,7 @@ MAX_ETUD_IN_DESCR = 20 def formsemestre_etuds_stats(context, sem, only_primo=False): - """Récupère liste d'etudiants avec etat et decision. - """ + """Récupère liste d'etudiants avec etat et decision.""" nt = context._getNotesCache().get_NotesTable( context, sem["formsemestre_id"] ) # > get_table_moyennes_triees, identdict, get_etud_decision_sem, get_etud_etat, @@ -361,12 +360,13 @@ def table_suivi_cohorte( percent=False, bac="", # selection sur type de bac bacspecialite="", + annee_bac="", sexe="", statut="", only_primo=False, ): """ - Tableau indicant le nombre d'etudiants de la cohorte dans chaque état: + Tableau indiquant le nombre d'etudiants de la cohorte dans chaque état: Etat date_debut_Sn date1 date2 ... S_n #inscrits en Sn S_n+1 @@ -399,6 +399,7 @@ def table_suivi_cohorte( orig_set = Set() # ensemble d'etudid du semestre d'origine bacs = Set() bacspecialites = Set() + annee_bacs = Set() sexes = Set() statuts = Set() for etudid in etudids: @@ -408,6 +409,7 @@ def table_suivi_cohorte( if ( (not bac or (bac == etud["bac"])) and (not bacspecialite or (bacspecialite == bacspe)) + and (not annee_bac or (annee_bac == str(etud["annee_bac"]))) and (not sexe or (sexe == etud["sexe"])) and (not statut or (statut == etud["statut"])) and (not only_primo or context.isPrimoEtud(etud, sem)) @@ -419,6 +421,7 @@ def table_suivi_cohorte( S[s["formsemestre_id"]] = s bacs.add(etud["bac"]) bacspecialites.add(bacspe) + annee_bacs.add(etud["annee_bac"]) sexes.add(etud["sexe"]) if etud["statut"]: # ne montre pas les statuts non renseignés statuts.add(etud["statut"]) @@ -608,6 +611,8 @@ def table_suivi_cohorte( dbac = "" if bacspecialite: dbac += " (spécialité %s)" % bacspecialite + if annee_bac: + dbac += " (année bac %s)" % annee_bac if sexe: dbac += " genre: %s" % sexe if statut: @@ -643,7 +648,7 @@ def table_suivi_cohorte( expl.append(", ".join(ls) + "") expl.append("") logt("Z: table_suivi_cohorte done") - return tab, "\n".join(expl), bacs, bacspecialites, sexes, statuts + return tab, "\n".join(expl), bacs, bacspecialites, annee_bacs, sexes, statuts def formsemestre_suivi_cohorte( @@ -653,21 +658,22 @@ def formsemestre_suivi_cohorte( percent=1, bac="", bacspecialite="", + annee_bac="", sexe="", statut="", only_primo=False, REQUEST=None, ): - """Affiche suivi cohortes par numero de semestre - """ + """Affiche suivi cohortes par numero de semestre""" percent = int(percent) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) - tab, expl, bacs, bacspecialites, sexes, statuts = table_suivi_cohorte( + tab, expl, bacs, bacspecialites, annee_bacs, sexes, statuts = table_suivi_cohorte( context, formsemestre_id, percent=percent, bac=bac, bacspecialite=bacspecialite, + annee_bac=annee_bac, sexe=sexe, statut=statut, only_primo=only_primo, @@ -714,10 +720,12 @@ def formsemestre_suivi_cohorte( only_primo=only_primo, bac=bac, bacspecialite=bacspecialite, + annee_bac=annee_bac, sexe=sexe, statut=statut, bacs=bacs, bacspecialites=bacspecialites, + annee_bacs=annee_bacs, sexes=sexes, statuts=statuts, percent=percent, @@ -737,10 +745,12 @@ def _gen_form_selectetuds( only_primo=None, bac=None, bacspecialite=None, + annee_bac=None, sexe=None, statut=None, bacs=None, bacspecialites=None, + annee_bacs=None, sexes=None, statuts=None, ): @@ -749,6 +759,8 @@ def _gen_form_selectetuds( bacs.sort() bacspecialites = list(bacspecialites) bacspecialites.sort() + annee_bacs = list(annee_bacs) + annee_bacs.sort() sexes = list(sexes) sexes.sort() statuts = list(statuts) @@ -789,6 +801,25 @@ def _gen_form_selectetuds( selected = "" F.append('' % (b, selected, b)) F.append("") + # + if annee_bac: + selected = "" + else: + selected = 'selected="selected"' + F.append( + """  Année bac: ") + # F.append( """  Genre: