diff --git a/app/comp/moy_sem.py b/app/comp/moy_sem.py
index 6a44dbc0..2aec3b73 100644
--- a/app/comp/moy_sem.py
+++ b/app/comp/moy_sem.py
@@ -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 la page du programme.
- """
- )
+ 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
diff --git a/app/comp/res_common.py b/app/comp/res_common.py
index 7fa75c1b..6a821ac6 100644
--- a/app/comp/res_common.py
+++ b/app/comp/res_common.py
@@ -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"]):
diff --git a/app/models/ues.py b/app/models/ues.py
index 09469fb0..2bed88a3 100644
--- a/app/models/ues.py
+++ b/app/models/ues.py
@@ -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
diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py
index 8f948855..73e77dbb 100644
--- a/app/scodoc/sco_edit_ue.py
+++ b/app/scodoc/sco_edit_ue.py
@@ -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"]
diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css
index bd99c80c..3b80f7d6 100644
--- a/app/static/css/scodoc.css
+++ b/app/static/css/scodoc.css
@@ -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;
diff --git a/app/templates/pn/form_ues.html b/app/templates/pn/form_ues.html
index 0cd3e333..98c590f7 100644
--- a/app/templates/pn/form_ues.html
+++ b/app/templates/pn/form_ues.html
@@ -38,7 +38,8 @@
{% set virg = joiner(", ") %}
(
{%- 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 'aucun'|safe}} ECTS)