diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index e91b62cc..a09c0731 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -27,6 +27,7 @@ """Tableau de bord module """ +import math import time from flask import g, url_for @@ -439,8 +440,8 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None): can_edit_evals=can_edit_evals, can_edit_notes=can_edit_notes, eval_index=eval_index, - has_expression=has_expression, nb_evals=len(mod_evals), + is_apc=nt.is_apc, ) ) eval_index -= 1 @@ -500,8 +501,8 @@ def _ligne_evaluation( can_edit_evals: bool = False, can_edit_notes: bool = False, eval_index: int = 0, - has_expression: bool = False, nb_evals: int = 0, + is_apc=False, ) -> str: """Ligne décrivant une évaluation dans le tableau de bord moduleimpl.""" H = [] @@ -524,6 +525,15 @@ def _ligne_evaluation( H.append(""" """) tr_class_1 += " mievr_spaced" H.append(f"""""") + coef = evaluation.coefficient + if is_apc: + coef *= sum(evaluation.get_ue_poids_dict().values()) + # Avertissement si coefs x poids nuls + if coef < scu.NOTES_PRECISION: + H.append("""coef. nul !""") + elif is_apc: + # visualisation des poids + H.append(_evaluation_poids_html(evaluation)) if evaluation.jour: H.append( f"""Le {evaluation.jour.strftime("%d/%m/%Y")} {evaluation.descr_heure()}""" @@ -543,12 +553,6 @@ def _ligne_evaluation( H.append( """session 2""" ) - # Avertissement si coefs/poids nuls - if ( - evaluation.coefficient * sum(evaluation.get_ue_poids_dict().values()) - < scu.NOTES_PRECISION - ): - H.append("""coef. nul !""") # if etat["last_modif"]: H.append( @@ -556,25 +560,27 @@ def _ligne_evaluation( etat["last_modif"].strftime("%d/%m/%Y à %Hh%M")})""" ) # - H.append('') - if has_expression or True: - H.append( - f"""{ - eval_index:2}""" - ) + H.append( + f""" + { + eval_index:2} + + """ + ) # Fleches: - H.append('') if eval_index != (nb_evals - 1) and can_edit_evals: H.append( - '%s' - % (evaluation.id, arrow_up) + f"""{arrow_up}""" ) else: H.append(arrow_none) if (eval_index > 0) and can_edit_evals: H.append( - '%s' - % (evaluation.id, arrow_down) + f"""{arrow_down}""" ) else: H.append(arrow_none) @@ -606,7 +612,7 @@ def _ligne_evaluation( else: etat_txt = "" if can_edit_evals and etat_txt: - etat_txt = f"""{etat_txt}""" @@ -679,21 +685,24 @@ def _ligne_evaluation( ) # H.append( - """ -%s%s""" - % (eval_dict["duree"], "%g" % eval_dict["coefficient"]) + f""" + {eval_dict["duree"]} + {eval_dict["coefficient"]:g} + """ ) H.append( - """%(nb_notes)s / %(nb_inscrits)s -%(nb_abs)s -%(nb_neutre)s -""" + f""" + {etat["nb_notes"]} / {etat["nb_inscrits"]} + {etat["nb_abs"]} + {etat["nb_neutre"]} + """ % etat ) if etat["moy"]: - H.append("%s / %g" % (etat["moy"], eval_dict["note_max"])) H.append( - f"""  ({etat["moy"]} / {eval_dict["note_max"]:g} +   (afficher)""" ) @@ -744,7 +753,8 @@ def _ligne_evaluation( ) if gr_moyenne["gr_nb_att"] > 0: H.append( - f""", {gr_moyenne["gr_nb_att"]} en attente""" + f""", { + gr_moyenne["gr_nb_att"]} en attente""" ) H.append(""")""") if gr_moyenne["group_id"] in etat["gr_incomplets"]: @@ -773,3 +783,30 @@ def _ligne_evaluation( H.append("") H.append("""""") return "\n".join(H) + + +def _evaluation_poids_html(evaluation: Evaluation) -> str: + """graphe html montrant les poids de l'évaluation""" + ue_poids = evaluation.get_ue_poids_dict() # { ue_id : poids } + if not ue_poids: + return + max_poids = max(ue_poids.values()) + if max_poids < scu.NOTES_PRECISION: + return + # style="--max:{max_poids} + H = ( + """
""" + + "\n".join( + [ + f"""
""" + for ue, poids in ( + (UniteEns.query.get(ue_id), poids) + for ue_id, poids in ue_poids.items() + ) + ] + ) + + "
" + ) + return H diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 0d62e3eb..ebebecb7 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1752,6 +1752,35 @@ div#modimpl_coefs { background-color: #9c0; } +/* visualisation poids évaluations */ +.evaluation_poids { + height: 12px; + display: inline-flex; + text-align: center; +} + +.evaluation_poids>div { + display: inline-flex; + height: 12px; + width: 12px; + margin-left: 2px; + margin-right: 2px; + /* padding: 0 0px 0 0px; */ + border: 1px solid rgb(180, 180, 180); + align-items: center; + justify-content: center; +} + +.evaluation_poids>div>div { + /* --height: calc(12px * var(--coef) / var(--max)); */ + height: var(--size); + width: var(--size); + /* padding: 0 0 0 0; */ + /* var(--height) */ + background: #09c; + /* box-sizing: border-box; */ +} + span.moduleimpl_abs_link { padding-right: 2em; } diff --git a/sco_version.py b/sco_version.py index ba9e502d..1a07329d 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.3.50" +SCOVERSION = "9.3.51" SCONAME = "ScoDoc"