1
0
forked from ScoDoc/ScoDoc

Fix: calcul moy avec ue_cap quand ue courante NaN

This commit is contained in:
Emmanuel Viennet 2022-02-09 18:43:03 +01:00
parent c29312e511
commit d3fe08689e
2 changed files with 10 additions and 5 deletions

View File

@ -233,24 +233,29 @@ class ResultatsSemestre(ResultatsCache):
"ue": ue.to_dict(), "ue": ue.to_dict(),
"formsemestre_id": None, "formsemestre_id": None,
"capitalized_ue_id": None, "capitalized_ue_id": None,
"ects_pot": 0.0,
} }
cur_moy_ue = self.etud_moy_ue[ue_id][etudid] cur_moy_ue = self.etud_moy_ue[ue_id][etudid]
moy_ue = cur_moy_ue moy_ue = cur_moy_ue
is_capitalized = False is_capitalized = False
if etudid in self.validations.ue_capitalisees.index: if etudid in self.validations.ue_capitalisees.index:
ue_cap = self._get_etud_ue_cap(etudid, ue) ue_cap = self._get_etud_ue_cap(etudid, ue)
if ue_cap is not None and not ue_cap.empty: if (
if ue_cap["moy_ue"] > cur_moy_ue: ue_cap is not None
and not ue_cap.empty
and not np.isnan(ue_cap["moy_ue"])
):
if ue_cap["moy_ue"] > cur_moy_ue or np.isnan(cur_moy_ue):
moy_ue = ue_cap["moy_ue"] moy_ue = ue_cap["moy_ue"]
is_capitalized = True is_capitalized = True
if is_capitalized:
coef_ue = 1.0
coef_ue = self.etud_coef_ue_df[ue_id][etudid] coef_ue = self.etud_coef_ue_df[ue_id][etudid]
return { return {
"is_capitalized": is_capitalized, "is_capitalized": is_capitalized,
"is_external": ue_cap["is_external"] if is_capitalized else ue.is_external, "is_external": ue_cap["is_external"] if is_capitalized else ue.is_external,
"coef_ue": coef_ue, "coef_ue": coef_ue,
"ects_pot": ue.ects or 0.0,
"cur_moy_ue": cur_moy_ue, "cur_moy_ue": cur_moy_ue,
"moy": moy_ue, "moy": moy_ue,
"event_date": ue_cap["event_date"] if is_capitalized else None, "event_date": ue_cap["event_date"] if is_capitalized else None,

View File

@ -702,7 +702,7 @@ def formsemestre_recap_parcours_table(
) )
# total ECTS (affiché sous la moyenne générale) # total ECTS (affiché sous la moyenne générale)
H.append( H.append(
'<td class="sem_ects_tit"><a title="crédit potentiels (dont nb de fondamentaux)">ECTS:</a></td><td class="sem_ects">%g</td>' '<td class="sem_ects_tit"><a title="crédit potentiels">ECTS:</a></td><td class="sem_ects">%g</td>'
% (etud_ects_infos["ects_pot"]) % (etud_ects_infos["ects_pot"])
) )
H.append('<td class="rcp_abs"></td>') H.append('<td class="rcp_abs"></td>')