forked from ScoDoc/ScoDoc
Gestion calcul moy gen et capit. BUT si ECTS manquants
This commit is contained in:
parent
68680e89d3
commit
ef408e5d8e
@ -30,8 +30,7 @@
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from flask import g, url_for
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
from flask import flash
|
||||
|
||||
|
||||
def compute_sem_moys_apc_using_coefs(
|
||||
@ -66,12 +65,8 @@ def compute_sem_moys_apc_using_ects(
|
||||
moy_gen = (etud_moy_ue_df * ects).sum(axis=1) / sum(ects)
|
||||
except TypeError:
|
||||
if None in ects:
|
||||
raise ScoValueError(
|
||||
f"""Calcul impossible: ECTS des UE manquants !
|
||||
voir <a href="{url_for("notes.ue_table", scodoc_dept=g.scodoc_dept,
|
||||
formation_id=formation_id)}">la page du programme</a>.
|
||||
"""
|
||||
)
|
||||
flash(f"""Calcul moyenne générale impossible: ECTS des UE manquants !""")
|
||||
moy_gen = pd.Series(np.NaN, index=etud_moy_ue_df.index)
|
||||
else:
|
||||
raise
|
||||
return moy_gen
|
||||
|
@ -259,9 +259,8 @@ class ResultatsSemestre(ResultatsCache):
|
||||
cur_moy_ue = self.etud_moy_ue[ue_id][etudid]
|
||||
moy_ue = cur_moy_ue
|
||||
is_capitalized = False # si l'UE prise en compte est une UE capitalisée
|
||||
was_capitalized = (
|
||||
False # s'il y a precedemment une UE capitalisée (pas forcement meilleure)
|
||||
)
|
||||
# s'il y a precedemment une UE capitalisée (pas forcement meilleure):
|
||||
was_capitalized = False
|
||||
if etudid in self.validations.ue_capitalisees.index:
|
||||
ue_cap = self._get_etud_ue_cap(etudid, ue)
|
||||
if ue_cap and not np.isnan(ue_cap["moy_ue"]):
|
||||
|
@ -54,13 +54,15 @@ class UniteEns(db.Model):
|
||||
'EXTERNE' if self.is_external else ''})>"""
|
||||
|
||||
def to_dict(self):
|
||||
"""as a dict, with the same conversions as in ScoDoc7"""
|
||||
"""as a dict, with the same conversions as in ScoDoc7
|
||||
(except ECTS: keep None)
|
||||
"""
|
||||
e = dict(self.__dict__)
|
||||
e.pop("_sa_instance_state", None)
|
||||
# ScoDoc7 output_formators
|
||||
e["ue_id"] = self.id
|
||||
e["numero"] = e["numero"] if e["numero"] else 0
|
||||
e["ects"] = e["ects"] if e["ects"] else 0.0
|
||||
e["ects"] = e["ects"]
|
||||
e["coefficient"] = e["coefficient"] if e["coefficient"] else 0.0
|
||||
e["code_apogee"] = e["code_apogee"] or "" # pas de None
|
||||
return e
|
||||
|
@ -89,6 +89,7 @@ _ueEditor = ndb.EditableTable(
|
||||
input_formators={
|
||||
"type": ndb.int_null_is_zero,
|
||||
"is_external": ndb.bool_or_str,
|
||||
"ects": ndb.float_null_is_null,
|
||||
},
|
||||
output_formators={
|
||||
"numero": ndb.int_null_is_zero,
|
||||
@ -347,6 +348,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
||||
"type": "float",
|
||||
"title": "ECTS",
|
||||
"explanation": "nombre de crédits ECTS",
|
||||
"allow_null": not is_apc, # ects requis en APC
|
||||
},
|
||||
),
|
||||
(
|
||||
@ -933,10 +935,10 @@ def _ue_table_ues(
|
||||
cur_ue_semestre_id = None
|
||||
iue = 0
|
||||
for ue in ues:
|
||||
if ue["ects"]:
|
||||
ue["ects_str"] = ", %g ECTS" % ue["ects"]
|
||||
else:
|
||||
if ue["ects"] is None:
|
||||
ue["ects_str"] = ""
|
||||
else:
|
||||
ue["ects_str"] = ", %g ECTS" % ue["ects"]
|
||||
if editable:
|
||||
klass = "span_apo_edit"
|
||||
else:
|
||||
@ -1295,7 +1297,6 @@ def do_ue_edit(args, bypass_lock=False, dont_invalidate_cache=False):
|
||||
f"""Acronyme d'UE "{args['acronyme']}" déjà utilisé !
|
||||
(chaque UE doit avoir un acronyme unique dans la formation)"""
|
||||
)
|
||||
|
||||
# On ne peut pas supprimer le code UE:
|
||||
if "ue_code" in args and not args["ue_code"]:
|
||||
del args["ue_code"]
|
||||
|
@ -1671,7 +1671,10 @@ div.formation_list_modules ul.notes_module_list {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
span.missing_ue_ects {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
li.module_malus span.formation_module_tit {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
|
@ -38,7 +38,8 @@
|
||||
{% set virg = joiner(", ") %}
|
||||
<span class="ue_code">(
|
||||
{%- if ue.ue_code -%}{{ virg() }}code {{ue.ue_code}} {%- endif -%}
|
||||
{{ virg() }}{{ue.ects or 0}} ECTS)
|
||||
{{ virg() }}{{ue.ects if ue.ects is not none
|
||||
else '<span class="missing_ue_ects">aucun</span>'|safe}} ECTS)
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user