WIP: fix rapide pour eviter plante quand démissionnaires

This commit is contained in:
Emmanuel Viennet 2021-12-15 08:12:47 +01:00
parent 25a441f7f2
commit 79e2c9476b
3 changed files with 9 additions and 8 deletions

View File

@ -22,7 +22,7 @@ def df_load_modimpl_inscr(formsemestre) -> pd.DataFrame:
"""
# méthode la moins lente: une requete par module, merge les dataframes
moduleimpl_ids = [m.id for m in formsemestre.modimpls]
etudids = [i.etudid for i in formsemestre.inscriptions]
etudids = [i.etudid for i in formsemestre.get_inscrits()]
df = pd.DataFrame(index=etudids, dtype=int)
for moduleimpl_id in moduleimpl_ids:
ins_df = pd.read_sql_query(

View File

@ -980,8 +980,8 @@ class NotesTable:
def get_table_moyennes_triees(self):
return self.T
def get_etud_rang(self, etudid):
return self.rangs[etudid]
def get_etud_rang(self, etudid) -> str:
return self.rangs.get(etudid, "999")
def get_etud_rang_group(self, etudid, group_id):
"""Returns rank of etud in this group and number of etuds in group.
@ -1350,10 +1350,11 @@ class NotesTable:
ues = self.get_ues() # incluant le(s) UE de sport
for t in self.T:
etudid = t[-1]
t[0] = results.etud_moy_gen[etudid]
for i, ue in enumerate(ues, start=1):
if ue["type"] != UE_SPORT:
t[i] = results.etud_moy_ue[ue["id"]][etudid]
if etudid in results.etud_moy_gen: # evite les démissionnaires
t[0] = results.etud_moy_gen[etudid]
for i, ue in enumerate(ues, start=1):
if ue["type"] != UE_SPORT:
t[i] = results.etud_moy_ue[ue["id"]][etudid]
# re-trie selon la nouvelle moyenne générale:
self.T.sort(key=self._row_key)
# Remplace aussi le rang:

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.1.5"
SCOVERSION = "9.1.6"
SCONAME = "ScoDoc"