forked from ScoDoc/ScoDoc
Messages flash flask sur ancioennes pages ScoDoc + warning ECTS BUT
This commit is contained in:
parent
ef408e5d8e
commit
e1db9c542b
@ -65,7 +65,7 @@ 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:
|
||||
flash(f"""Calcul moyenne générale impossible: ECTS des UE manquants !""")
|
||||
flash("""Calcul moyenne générale impossible: ECTS des UE manquants !""")
|
||||
moy_gen = pd.Series(np.NaN, index=etud_moy_ue_df.index)
|
||||
else:
|
||||
raise
|
||||
|
@ -9,7 +9,7 @@ from functools import cached_property
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from flask import g, url_for
|
||||
from flask import g, flash, url_for
|
||||
|
||||
from app import log
|
||||
from app.comp.aux_stats import StatsMoyenne
|
||||
@ -419,21 +419,31 @@ class NotesTableCompat(ResultatsSemestre):
|
||||
"""Stats (moy/min/max) sur la moyenne générale"""
|
||||
return StatsMoyenne(self.etud_moy_gen)
|
||||
|
||||
def get_ues_stat_dict(self, filter_sport=False): # was get_ues()
|
||||
def get_ues_stat_dict(
|
||||
self, filter_sport=False, check_apc_ects=True
|
||||
) -> list[dict]: # was get_ues()
|
||||
"""Liste des UEs, ordonnée par numero.
|
||||
Si filter_sport, retire les UE de type SPORT.
|
||||
Résultat: liste de dicts { champs UE U stats moyenne UE }
|
||||
"""
|
||||
ues = []
|
||||
for ue in self.formsemestre.query_ues(with_sport=not filter_sport):
|
||||
ues = self.formsemestre.query_ues(with_sport=not filter_sport)
|
||||
ues_dict = []
|
||||
for ue in ues:
|
||||
d = ue.to_dict()
|
||||
if ue.type != UE_SPORT:
|
||||
moys = self.etud_moy_ue[ue.id]
|
||||
else:
|
||||
moys = None
|
||||
d.update(StatsMoyenne(moys).to_dict())
|
||||
ues.append(d)
|
||||
return ues
|
||||
ues_dict.append(d)
|
||||
if check_apc_ects and self.is_apc and not hasattr(g, "checked_apc_ects"):
|
||||
g.checked_apc_ects = True
|
||||
if None in [ue.ects for ue in ues if ue.type != UE_SPORT]:
|
||||
flash(
|
||||
"""Calcul moyenne générale impossible: ECTS des UE manquants !""",
|
||||
category="danger",
|
||||
)
|
||||
return ues_dict
|
||||
|
||||
def get_modimpls_dict(self, ue_id=None) -> list[dict]:
|
||||
"""Liste des modules pour une UE (ou toutes si ue_id==None),
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
import html
|
||||
|
||||
from flask import g
|
||||
from flask import render_template
|
||||
from flask import request
|
||||
from flask_login import current_user
|
||||
|
||||
@ -280,6 +280,9 @@ def sco_header(
|
||||
if not no_side_bar:
|
||||
H.append(html_sidebar.sidebar())
|
||||
H.append("""<div id="gtrcontent">""")
|
||||
# En attendant le replacement complet de cette fonction,
|
||||
# inclusion ici des messages flask
|
||||
H.append(render_template("flashed_messages.html"))
|
||||
#
|
||||
# Barre menu semestre:
|
||||
H.append(formsemestre_page_title())
|
||||
|
@ -472,8 +472,10 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
||||
"semestre_id": tf[2]["semestre_idx"],
|
||||
},
|
||||
)
|
||||
flash("UE créée")
|
||||
else:
|
||||
do_ue_edit(tf[2])
|
||||
flash("UE modifiée")
|
||||
return flask.redirect(
|
||||
url_for(
|
||||
"notes.ue_table",
|
||||
|
@ -138,7 +138,7 @@ div.head_message {
|
||||
border-radius: 8px;
|
||||
font-family : arial, verdana, sans-serif ;
|
||||
font-weight: bold;
|
||||
width: 40%;
|
||||
width: 70%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user