Cosmetic: tableau bord module: code + présentation
This commit is contained in:
parent
7a9dc11af3
commit
63fb09348d
@ -13,6 +13,8 @@ from app.models.ues import UniteEns
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
import app.scodoc.notesdb as ndb
|
||||
|
||||
DEFAULT_EVALUATION_TIME = datetime.time(8, 0)
|
||||
|
||||
|
||||
class Evaluation(db.Model):
|
||||
"""Evaluation (contrôle, examen, ...)"""
|
||||
@ -111,12 +113,24 @@ class Evaluation(db.Model):
|
||||
if self.heure_debut and (
|
||||
not self.heure_fin or self.heure_fin == self.heure_debut
|
||||
):
|
||||
return f"""à {self.heure_debut.strftime("%H:%M")}"""
|
||||
return f"""à {self.heure_debut.strftime("%Hh%M")}"""
|
||||
elif self.heure_debut and self.heure_fin:
|
||||
return f"""de {self.heure_debut.strftime("%H:%M")} à {self.heure_fin.strftime("%H:%M")}"""
|
||||
return f"""de {self.heure_debut.strftime("%Hh%M")} à {self.heure_fin.strftime("%Hh%M")}"""
|
||||
else:
|
||||
return ""
|
||||
|
||||
def descr_duree(self) -> str:
|
||||
"Description de la durée pour affichages"
|
||||
if self.heure_debut is None and self.heure_fin is None:
|
||||
return ""
|
||||
debut = self.heure_debut or DEFAULT_EVALUATION_TIME
|
||||
fin = self.heure_fin or DEFAULT_EVALUATION_TIME
|
||||
d = (fin.hour * 60 + fin.minute) - (debut.hour * 60 + debut.minute)
|
||||
duree = f"{d//60}h"
|
||||
if d % 60:
|
||||
duree += f"{d%60:02d}"
|
||||
return duree
|
||||
|
||||
def clone(self, not_copying=()):
|
||||
"""Clone, not copying the given attrs
|
||||
Attention: la copie n'a pas d'id avant le prochain commit
|
||||
|
@ -203,16 +203,22 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
||||
mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list(
|
||||
moduleimpl_id=M["moduleimpl_id"]
|
||||
moduleimpl_id=moduleimpl_id
|
||||
)
|
||||
|
||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||
|
||||
mod_evals = sco_evaluation_db.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
|
||||
mod_evals.sort(
|
||||
key=lambda x: (x["numero"], x["jour"], x["heure_debut"]), reverse=True
|
||||
) # la plus RECENTE en tête
|
||||
|
||||
# mod_evals = sco_evaluation_db.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
|
||||
# mod_evals.sort(
|
||||
# key=lambda x: (x["numero"], x["jour"], x["heure_debut"]), reverse=True
|
||||
# )
|
||||
# la plus RECENTE en tête
|
||||
evaluations = modimpl.evaluations.order_by(
|
||||
Evaluation.numero.desc(),
|
||||
Evaluation.jour.desc(),
|
||||
Evaluation.heure_debut.desc(),
|
||||
).all()
|
||||
nb_evaluations = len(evaluations)
|
||||
#
|
||||
sem_locked = not sem["etat"]
|
||||
can_edit_evals = (
|
||||
@ -329,8 +335,10 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
# )
|
||||
H.append("</td></tr>")
|
||||
H.append(
|
||||
'<tr><td colspan="4"><span class="moduleimpl_abs_link"><a class="stdlink" href="view_module_abs?moduleimpl_id=%s">Absences dans ce module</a></span>'
|
||||
% moduleimpl_id
|
||||
f"""<tr><td colspan="4"><span class="moduleimpl_abs_link"><a class="stdlink"
|
||||
href="{
|
||||
url_for("notes.view_module_abs", scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
|
||||
}">Absences dans ce module</a></span>"""
|
||||
)
|
||||
# Adapté à partir d'une suggestion de DS (Le Havre)
|
||||
# Liens saisies absences seulement si permission et date courante dans le semestre
|
||||
@ -372,13 +380,14 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
"""<p><form name="f"><span style="font-size:120%%; font-weight: bold;">%d évaluations :</span>
|
||||
<span style="padding-left: 30px;">
|
||||
<input type="hidden" name="moduleimpl_id" value="%s"/>"""
|
||||
% (len(mod_evals), moduleimpl_id)
|
||||
% (nb_evaluations, moduleimpl_id)
|
||||
)
|
||||
#
|
||||
# Liste les noms de partitions
|
||||
partitions = sco_groups.get_partitions_list(sem["formsemestre_id"])
|
||||
H.append(
|
||||
"""Afficher les groupes de <select name="partition_id" onchange="document.f.submit();">"""
|
||||
"""Afficher les groupes
|
||||
de <select name="partition_id" onchange="document.f.submit();">"""
|
||||
)
|
||||
been_selected = False
|
||||
for partition in partitions:
|
||||
@ -414,27 +423,27 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
url_for("notes.evaluation_create", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'])
|
||||
}">Créer nouvelle évaluation</a>
|
||||
"""
|
||||
if mod_evals:
|
||||
if nb_evaluations > 0:
|
||||
top_table_links += f"""
|
||||
<a class="stdlink" style="margin-left:2em;" href="{
|
||||
url_for("notes.module_evaluation_renumber", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'],
|
||||
redirect=1)
|
||||
}">Trier par date</a>
|
||||
"""
|
||||
if mod_evals:
|
||||
if nb_evaluations > 0:
|
||||
H.append(
|
||||
'<div class="moduleimpl_evaluations_top_links">'
|
||||
+ top_table_links
|
||||
+ "</div>"
|
||||
)
|
||||
H.append("""<table class="moduleimpl_evaluations">""")
|
||||
eval_index = len(mod_evals) - 1
|
||||
eval_index = nb_evaluations - 1
|
||||
first_eval = True
|
||||
for eval_dict in mod_evals:
|
||||
for evaluation in evaluations:
|
||||
H.append(
|
||||
_ligne_evaluation(
|
||||
modimpl,
|
||||
eval_dict,
|
||||
evaluation,
|
||||
first_eval=first_eval,
|
||||
partition_id=partition_id,
|
||||
arrow_down=arrow_down,
|
||||
@ -443,7 +452,7 @@ 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,
|
||||
nb_evals=len(mod_evals),
|
||||
nb_evals=nb_evaluations,
|
||||
is_apc=nt.is_apc,
|
||||
)
|
||||
)
|
||||
@ -495,7 +504,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
|
||||
def _ligne_evaluation(
|
||||
modimpl: ModuleImpl,
|
||||
eval_dict: dict,
|
||||
evaluation: Evaluation,
|
||||
first_eval: bool = True,
|
||||
partition_id=None,
|
||||
arrow_down=None,
|
||||
@ -509,8 +518,7 @@ def _ligne_evaluation(
|
||||
) -> str:
|
||||
"""Ligne <tr> décrivant une évaluation dans le tableau de bord moduleimpl."""
|
||||
H = []
|
||||
# TODO unifier pour ne plus utiliser eval_dict
|
||||
evaluation: Evaluation = Evaluation.query.get(eval_dict["evaluation_id"])
|
||||
# evaluation: Evaluation = Evaluation.query.get(eval_dict["evaluation_id"])
|
||||
etat = sco_evaluations.do_evaluation_etat(
|
||||
evaluation.id,
|
||||
partition_id=partition_id,
|
||||
@ -543,7 +551,7 @@ def _ligne_evaluation(
|
||||
elif is_apc:
|
||||
# visualisation des poids
|
||||
H.append(_evaluation_poids_html(evaluation))
|
||||
|
||||
H.append("""<div class="evaluation_titre">""")
|
||||
if evaluation.jour:
|
||||
H.append(
|
||||
f"""Le {evaluation.jour.strftime("%d/%m/%Y")} {evaluation.descr_heure()}"""
|
||||
@ -571,7 +579,7 @@ def _ligne_evaluation(
|
||||
)
|
||||
#
|
||||
H.append(
|
||||
f"""<span class="evalindex_cont">
|
||||
f"""<div class="evaluation_order">
|
||||
<span class="evalindex" title="Indice dans les vecteurs (formules)">{
|
||||
eval_index:2}</span>
|
||||
<span class="eval_arrows_chld">
|
||||
@ -597,6 +605,7 @@ def _ligne_evaluation(
|
||||
|
||||
H.append(
|
||||
f"""</span></span></td>
|
||||
</div>
|
||||
</tr>
|
||||
<tr class="{tr_class}">
|
||||
<th class="moduleimpl_evaluations" colspan="2"> </th>
|
||||
@ -611,7 +620,7 @@ def _ligne_evaluation(
|
||||
if etat["evalcomplete"]:
|
||||
etat_txt = """(prise en compte)"""
|
||||
etat_descr = "notes utilisées dans les moyennes"
|
||||
elif eval_dict["publish_incomplete"]:
|
||||
elif evaluation.publish_incomplete:
|
||||
etat_txt = """(prise en compte <b>immédiate</b>)"""
|
||||
etat_descr = (
|
||||
"il manque des notes, mais la prise en compte immédiate a été demandée"
|
||||
@ -677,7 +686,7 @@ def _ligne_evaluation(
|
||||
}">{scu.icontag("status_orange_img", title="il manque des notes")}</a>"""
|
||||
)
|
||||
#
|
||||
if eval_dict["visibulletin"]:
|
||||
if evaluation.visibulletin:
|
||||
H.append(
|
||||
scu.icontag(
|
||||
"status_visible_img", title="visible dans bulletins intermédiaires"
|
||||
@ -696,8 +705,8 @@ def _ligne_evaluation(
|
||||
#
|
||||
H.append(
|
||||
f"""</td>
|
||||
<td class="mievr_dur">{eval_dict["duree"]}</td>
|
||||
<td class="rightcell mievr_coef">{eval_dict["coefficient"]:g}</td>
|
||||
<td class="mievr_dur">{evaluation.descr_duree()}</td>
|
||||
<td class="rightcell mievr_coef">{evaluation.coefficient:g}</td>
|
||||
"""
|
||||
)
|
||||
H.append(
|
||||
@ -710,7 +719,7 @@ def _ligne_evaluation(
|
||||
)
|
||||
if etat["moy"]:
|
||||
H.append(
|
||||
f"""<b>{etat["moy"]} / {eval_dict["note_max"]:g}</b>
|
||||
f"""<b>{etat["moy"]} / {evaluation.note_max:g}</b>
|
||||
(<a class="stdlink" href="{
|
||||
url_for('notes.evaluation_listenotes',
|
||||
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
||||
|
@ -1770,12 +1770,19 @@ div#modimpl_coefs {
|
||||
background-color: #9c0;
|
||||
}
|
||||
|
||||
div.evaluation_titre {
|
||||
margin-top: 4px;
|
||||
display: inline-flex;
|
||||
vertical-align: super;
|
||||
}
|
||||
|
||||
/* visualisation poids évaluations */
|
||||
.evaluation_poids {
|
||||
height: 12px;
|
||||
display: inline-flex;
|
||||
text-align: center;
|
||||
vertical-align: super;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.evaluation_poids>div {
|
||||
@ -1851,6 +1858,8 @@ span.mievr_rattr {
|
||||
tr.mievr td.mievr_tit {
|
||||
font-weight: bold;
|
||||
background-color: #cccccc;
|
||||
border-top-left-radius: 8px;
|
||||
border-top-right-radius: 8px;
|
||||
}
|
||||
|
||||
tr.mievr td {
|
||||
@ -1913,8 +1922,9 @@ span.eval_warning_coef {
|
||||
background-color: rgb(255, 225, 0);
|
||||
}
|
||||
|
||||
span.evalindex_cont {
|
||||
float: right;
|
||||
div.evaluation_order {
|
||||
position: absolute;
|
||||
right: 1em;
|
||||
}
|
||||
|
||||
span.evalindex {
|
||||
|
Loading…
Reference in New Issue
Block a user