1
0
forked from ScoDoc/ScoDoc

Affichage des coefs de modules (avec Sébastien)

This commit is contained in:
Emmanuel Viennet 2021-12-02 21:16:14 +01:00
parent d435f3b835
commit 9ee0acd60b
2 changed files with 51 additions and 8 deletions

View File

@ -155,6 +155,31 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0):
return htmlutils.make_menu("actions", menuEval, alone=True)
def _ue_coefs_html(coefs_descr) -> str:
""" """
max_coef = max([x[1] for x in coefs_descr])
H = """
<div id="modimpl_coefs">
<div>Coefficients vers les UE</div>
"""
if coefs_descr:
H += f"""
<div class="coefs_histo" style="--max:{max_coef}">
""" + "\n".join(
[
f"""<div style="--coef:{coef}"><div>{coef}</div>{ue_acronyme}</div>"""
for ue_acronyme, coef in coefs_descr
]
)
else:
H += """<div class="missing_value">non définis</span>"""
H += """
</div>
</div>
"""
return H
def moduleimpl_status(moduleimpl_id=None, partition_id=None):
"""Tableau de bord module (liste des evaluations etc)"""
modimpl = ModuleImpl.query.get_or_404(moduleimpl_id)
@ -226,16 +251,11 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
H.append("""</td><td>""")
if not sem["etat"]:
H.append(scu.icontag("lock32_img", title="verrouillé"))
H.append("""</td><td class="fichetitre2">Coef. dans le semestre: """)
H.append("""</td><td class="fichetitre2">""")
if modimpl.module.is_apc():
coefs_descr = modimpl.module.ue_coefs_descr()
if coefs_descr:
coefs_descr_txt = ", ".join(["%s: %s" % x for x in coefs_descr])
H.append(_ue_coefs_html(modimpl.module.ue_coefs_descr()))
else:
coefs_descr_txt = """<span class="missing_value">non définis</span>"""
H.append(coefs_descr_txt)
else:
H.append(f"{modimpl.module.coefficient}")
H.append(f"Coef. dans le semestre: {modimpl.module.coefficient}")
H.append("""</td><td></td></tr>""")
# 3ieme ligne: Formation
H.append(

View File

@ -1291,6 +1291,29 @@ div.moduleimpl_type_ressource {
background-color:#f5e9d2;
}
div#modimpl_coefs {
position: absolute;
}
.coefs_histo{
height: 32px;
display: flex;
gap: 4px;
color: rgb(0, 0, 0);
text-align: center;
align-items: flex-end;
font-weight: normal;
font-size: 60%;
}
.coefs_histo>div{
background: #09c;
box-sizing: border-box;
padding: 4px;
height: calc(100% * var(--coef) / var(--max));
}
.coefs_histo>div:nth-child(odd){
background-color: #9c0;
}
span.moduleimpl_abs_link {
padding-right: 2em;
}