1
0
forked from ScoDoc/ScoDoc

Merge branch 'master' of https://scodoc.org/git/viennet/ScoDoc into refactor_nt

WIP
This commit is contained in:
Emmanuel Viennet 2022-01-09 22:33:08 +01:00
commit 782e291725
6 changed files with 169 additions and 127 deletions

View File

@ -30,6 +30,7 @@ class BulletinBUT(ResultatsSemestreBUT):
ue_idx = self.modimpl_coefs_df.index.get_loc(ue.id)
etud_moy_module = self.sem_cube[etud_idx] # module x UE
for modimpl in modimpls:
if self.modimpl_inscr_df[str(modimpl.id)][etud.id]: # si inscrit
coef = self.modimpl_coefs_df[modimpl.id][ue.id]
if coef > 0:
d[modimpl.module.code] = {
@ -87,6 +88,7 @@ class BulletinBUT(ResultatsSemestreBUT):
# except RuntimeWarning: # all nans in np.nanmean
# pass
modimpl_results = self.modimpls_results[modimpl.id]
if self.modimpl_inscr_df[str(modimpl.id)][etud.id]: # si inscrit
d[modimpl.module.code] = {
"id": modimpl.id,
"titre": modimpl.module.titre,

View File

@ -68,11 +68,12 @@ def bulletin_but_xml_compat(
"bulletin_but_xml_compat( formsemestre_id=%s, etudid=%s )"
% (formsemestre_id, etudid)
)
sem = FormSemestre.query.get_or_404(formsemestre_id)
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
etud = Identite.query.get_or_404(etudid)
results = bulletin_but.ResultatsSemestreBUT(sem)
results = bulletin_but.ResultatsSemestreBUT(formsemestre)
nb_inscrits = len(results.etuds)
if (not sem.bul_hide_xml) or force_publishing:
etat_inscription = etud.etat_inscription(formsemestre.id)
if (not formsemestre.bul_hide_xml) or force_publishing:
published = 1
else:
published = 0
@ -86,10 +87,10 @@ def bulletin_but_xml_compat(
"date": docdate,
"publie": str(published),
}
if sem.etapes:
el["etape_apo"] = sem.etapes[0].etape_apo or ""
if formsemestre.etapes:
el["etape_apo"] = formsemestre.etapes[0].etape_apo or ""
n = 2
for et in sem.etapes[1:]:
for et in formsemestre.etapes[1:]:
el["etape_apo" + str(n)] = et.etape_apo or ""
n += 1
x = Element("bulletinetud", **el)
@ -120,6 +121,8 @@ def bulletin_but_xml_compat(
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(
scu.SCO_ENCODING
) # stop !
if etat_inscription == scu.INSCRIT:
# Moyenne générale:
doc.append(
Element(
@ -170,7 +173,7 @@ def bulletin_but_xml_compat(
for modimpl in results.modimpls:
# Liste ici uniquement les modules rattachés à cette UE
if modimpl.module.ue.id == ue.id:
mod_moy = scu.fmt_note(results.etud_moy_ue[ue.id][etud.id])
# mod_moy = scu.fmt_note(results.etud_moy_ue[ue.id][etud.id])
coef = results.modimpl_coefs_df[modimpl.id][ue.id]
x_mod = Element(
"module",
@ -180,17 +183,9 @@ def bulletin_but_xml_compat(
numero=str(modimpl.module.numero or 0),
titre=scu.quote_xml_attr(modimpl.module.titre or ""),
abbrev=scu.quote_xml_attr(modimpl.module.abbrev or ""),
code_apogee=scu.quote_xml_attr(modimpl.module.code_apogee or ""),
)
x_ue.append(x_mod)
x_mod.append(
Element(
"note",
value=mod_moy,
min=scu.fmt_note(results.etud_moy_ue[ue.id].min()),
max=scu.fmt_note(results.etud_moy_ue[ue.id].max()),
moy=scu.fmt_note(results.etud_moy_ue[ue.id].mean()),
)
code_apogee=scu.quote_xml_attr(
modimpl.module.code_apogee or ""
),
)
# XXX TODO rangs et effectifs
# --- notes de chaque eval:
@ -230,7 +225,7 @@ def bulletin_but_xml_compat(
# --- Absences
if sco_preferences.get_preference("bul_show_abs", formsemestre_id):
nbabs, nbabsjust = sem.get_abs_count(etud.id)
nbabs, nbabsjust = formsemestre.get_abs_count(etud.id)
doc.append(Element("absences", nbabs=str(nbabs), nbabsjust=str(nbabsjust)))
# -------- LA SUITE EST COPIEE SANS MODIF DE sco_bulletins_xml.py ---------

View File

@ -44,6 +44,9 @@ class ModuleImpl(db.Model):
def __init__(self, **kwargs):
super(ModuleImpl, self).__init__(**kwargs)
def __repr__(self):
return f"<{self.__class__.__name__} {self.id} module={repr(self.module)}>"
def get_evaluations_poids(self) -> pd.DataFrame:
"""Les poids des évaluations vers les UE (accès via cache)"""
evaluations_poids = df_cache.EvaluationsPoidsCache.get(self.id)

View File

@ -470,7 +470,13 @@ def ue_delete(ue_id=None, delete_validations=False, dialog_confirmed=False):
if ue.modules.all():
raise ScoValueError(
f"""Suppression de l'UE {ue.titre} impossible car
des modules (ou SAÉ ou ressources) lui sont rattachés."""
des modules (ou SAÉ ou ressources) lui sont rattachés.""",
dest_url=url_for(
"notes.ue_table",
scodoc_dept=g.scodoc_dept,
formation_id=ue.formation.id,
semestre_idx=ue.semestre_idx,
),
)
if not can_delete_ue(ue):
raise ScoNonEmptyFormationObject(

View File

@ -77,6 +77,17 @@ section>div:nth-child(1){
display: flex !important;
}
.listeOff .ue::before,
.listeOff .module::before,
.moduleOnOff .ue::before,
.moduleOnOff .module::before{
transform: rotate(0);
}
.listeOff .moduleOnOff .ue::before,
.listeOff .moduleOnOff .module::before{
transform: rotate(180deg) !important;
}
/***********************/
/* Options d'affichage */
/***********************/
@ -118,11 +129,16 @@ section>div:nth-child(1){
/************/
/* Semestre */
/************/
.flex{
display: flex;
gap: 16px;
}
.infoSemestre{
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 4px;
flex: none;
}
.infoSemestre>div{
border: 1px solid var(--couleurIntense);
@ -141,7 +157,12 @@ section>div:nth-child(1){
.rang{
text-decoration: underline var(--couleurIntense);
}
.decision{
margin: 5px 0;
font-weight: bold;
font-size: 20px;
text-decoration: underline var(--couleurIntense);
}
.enteteSemestre{
color: black;
font-weight: bold;
@ -174,8 +195,21 @@ section>div:nth-child(1){
display: flex;
gap: 16px;
margin: 4px 0 2px 0;
overflow: auto;
overflow-x: auto;
overflow-y: hidden;
cursor: pointer;
position: relative;
}
.module::before, .ue::before {
content:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='26px' height='26px' fill='black'><path d='M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z' /></svg>");
width: 26px;
height: 26px;
position: absolute;
bottom: 0;
left: 50%;
margin-left: -13px;
transform: rotate(180deg);
transition: 0.2s;
}
h3{
display: flex;

View File

@ -75,10 +75,15 @@ class releveBUT extends HTMLElement {
<!--------------------------->
<section>
<h2>Semestre </h2>
<div class=dateInscription>Inscrit le </div>
<em>Les moyennes servent à situer l'étudiant dans la promotion et ne correspondent pas à des validations de
compétences ou d'UE.</em>
<div class=flex>
<div class=infoSemestre></div>
<div>
<div class=decision>Validé !</div>
<div class=dateInscription>Inscrit le </div>
<em>Les moyennes servent à situer l'étudiant dans la promotion et ne correspondent pas à des validations de compétences ou d'UE.</em>
</div>
</div>
</section>
<!--------------------------->
@ -91,8 +96,7 @@ class releveBUT extends HTMLElement {
<em>La moyenne des ressources dans une UE dépend des poids donnés aux évaluations.</em>
</div>
<div class=CTA_Liste>
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none"
stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 15l-6-6-6 6" />
</svg>
</div>
@ -107,8 +111,7 @@ class releveBUT extends HTMLElement {
<div>
<h2>Ressources</h2>
<div class=CTA_Liste>
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none"
stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 15l-6-6-6 6" />
</svg>
</div>
@ -120,8 +123,7 @@ class releveBUT extends HTMLElement {
<div>
<h2>SAÉ</h2>
<div class=CTA_Liste>
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none"
stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 15l-6-6-6 6" />
</svg>
</div>
@ -187,8 +189,8 @@ class releveBUT extends HTMLElement {
<div>Max. promo. :</div><div>${data.semestre.notes.max}</div>
<div>Moy. promo. :</div><div>${data.semestre.notes.moy}</div>
<div>Min. promo. :</div><div>${data.semestre.notes.min}</div>
</div>
${data.semestre.groupes.map(groupe => {
</div>`;
/*${data.semestre.groupes.map(groupe => {
return `
<div>
<div class=enteteSemestre>Groupe</div><div class=enteteSemestre>${groupe.nom}</div>
@ -199,9 +201,9 @@ class releveBUT extends HTMLElement {
</div>
`;
}).join("")
}
`;
}*/
this.shadow.querySelector(".infoSemestre").innerHTML = output;
this.shadow.querySelector(".decision").innerHTML = data.semestre.decision.code;
}
/*******************************/