forked from ScoDoc/ScoDoc
813 lines
29 KiB
Python
813 lines
29 KiB
Python
# -*- mode: python -*-
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
#
|
|
# Gestion scolarite IUT
|
|
#
|
|
# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
|
#
|
|
##############################################################################
|
|
|
|
"""Tableau de bord module
|
|
"""
|
|
import math
|
|
import time
|
|
|
|
from flask import g, url_for
|
|
from flask_login import current_user
|
|
|
|
from app.auth.models import User
|
|
from app.comp import res_sem
|
|
from app.comp.res_compat import NotesTableCompat
|
|
from app.models import ModuleImpl
|
|
from app.models.evaluations import Evaluation
|
|
from app.models.ues import UniteEns
|
|
import app.scodoc.sco_utils as scu
|
|
from app.scodoc.sco_exceptions import ScoInvalidIdType
|
|
from app.scodoc.sco_cursus_dut import formsemestre_has_decisions
|
|
from app.scodoc.sco_permissions import Permission
|
|
|
|
from app.scodoc import html_sco_header
|
|
from app.scodoc import htmlutils
|
|
from app.scodoc import sco_abs
|
|
from app.scodoc import sco_compute_moy
|
|
from app.scodoc import sco_cache
|
|
from app.scodoc import sco_edit_module
|
|
from app.scodoc import sco_evaluations
|
|
from app.scodoc import sco_evaluation_db
|
|
from app.scodoc import sco_formations
|
|
from app.scodoc import sco_formsemestre
|
|
from app.scodoc import sco_formsemestre_status
|
|
from app.scodoc import sco_groups
|
|
from app.scodoc import sco_moduleimpl
|
|
from app.scodoc import sco_permissions_check
|
|
from app.scodoc import sco_users
|
|
|
|
# ported from old DTML code in oct 2009
|
|
|
|
# menu evaluation dans moduleimpl
|
|
def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0):
|
|
"Menu avec actions sur une evaluation"
|
|
E = sco_evaluation_db.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
|
modimpl = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0]
|
|
|
|
group_id = sco_groups.get_default_group(modimpl["formsemestre_id"])
|
|
|
|
if (
|
|
sco_permissions_check.can_edit_notes(
|
|
current_user, E["moduleimpl_id"], allow_ens=False
|
|
)
|
|
and nbnotes != 0
|
|
):
|
|
sup_label = "Supprimer évaluation impossible (il y a des notes)"
|
|
else:
|
|
sup_label = "Supprimer évaluation"
|
|
|
|
menuEval = [
|
|
{
|
|
"title": "Saisir notes",
|
|
"endpoint": "notes.saisie_notes",
|
|
"args": {
|
|
"evaluation_id": evaluation_id,
|
|
},
|
|
"enabled": sco_permissions_check.can_edit_notes(
|
|
current_user, E["moduleimpl_id"]
|
|
),
|
|
},
|
|
{
|
|
"title": "Modifier évaluation",
|
|
"endpoint": "notes.evaluation_edit",
|
|
"args": {
|
|
"evaluation_id": evaluation_id,
|
|
},
|
|
"enabled": sco_permissions_check.can_edit_notes(
|
|
current_user, E["moduleimpl_id"], allow_ens=False
|
|
),
|
|
},
|
|
{
|
|
"title": sup_label,
|
|
"endpoint": "notes.evaluation_delete",
|
|
"args": {
|
|
"evaluation_id": evaluation_id,
|
|
},
|
|
"enabled": nbnotes == 0
|
|
and sco_permissions_check.can_edit_notes(
|
|
current_user, E["moduleimpl_id"], allow_ens=False
|
|
),
|
|
},
|
|
{
|
|
"title": "Supprimer toutes les notes",
|
|
"endpoint": "notes.evaluation_suppress_alln",
|
|
"args": {
|
|
"evaluation_id": evaluation_id,
|
|
},
|
|
"enabled": sco_permissions_check.can_edit_notes(
|
|
current_user, E["moduleimpl_id"], allow_ens=False
|
|
),
|
|
},
|
|
{
|
|
"title": "Afficher les notes",
|
|
"endpoint": "notes.evaluation_listenotes",
|
|
"args": {
|
|
"evaluation_id": evaluation_id,
|
|
},
|
|
"enabled": nbnotes > 0,
|
|
},
|
|
{
|
|
"title": "Placement étudiants",
|
|
"endpoint": "notes.placement_eval_selectetuds",
|
|
"args": {
|
|
"evaluation_id": evaluation_id,
|
|
},
|
|
"enabled": sco_permissions_check.can_edit_notes(
|
|
current_user, E["moduleimpl_id"]
|
|
),
|
|
},
|
|
{
|
|
"title": "Absences ce jour",
|
|
"endpoint": "absences.EtatAbsencesDate",
|
|
"args": {
|
|
"date": E["jour"],
|
|
"group_ids": group_id,
|
|
},
|
|
"enabled": E["jour"],
|
|
},
|
|
{
|
|
"title": "Vérifier notes vs absents",
|
|
"endpoint": "notes.evaluation_check_absences_html",
|
|
"args": {
|
|
"evaluation_id": evaluation_id,
|
|
},
|
|
"enabled": nbnotes > 0 and E["jour"],
|
|
},
|
|
]
|
|
|
|
return htmlutils.make_menu("actions", menuEval, alone=True)
|
|
|
|
|
|
def _ue_coefs_html(coefs_lst) -> str:
|
|
""" """
|
|
max_coef = max([x[1] for x in coefs_lst]) if coefs_lst else 1.0
|
|
H = """
|
|
<div id="modimpl_coefs">
|
|
<div>Coefficients vers les UE</div>
|
|
"""
|
|
if coefs_lst:
|
|
H += (
|
|
f"""
|
|
<div class="coefs_histo" style="--max:{max_coef}">
|
|
"""
|
|
+ "\n".join(
|
|
[
|
|
f"""<div style="--coef:{coef};
|
|
{'background-color: ' + ue.color + ';' if ue.color else ''}
|
|
"><div>{coef}</div>{ue.acronyme}</div>"""
|
|
for ue, coef in coefs_lst
|
|
]
|
|
)
|
|
+ "</div>"
|
|
)
|
|
else:
|
|
H += """<div class="missing_value">non définis</div>"""
|
|
H += "</div>"
|
|
return H
|
|
|
|
|
|
def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|
"""Tableau de bord module (liste des evaluations etc)"""
|
|
if not isinstance(moduleimpl_id, int):
|
|
raise ScoInvalidIdType("moduleimpl_id must be an integer !")
|
|
modimpl: ModuleImpl = ModuleImpl.query.get_or_404(moduleimpl_id)
|
|
M = modimpl.to_dict()
|
|
formsemestre_id = modimpl.formsemestre_id
|
|
Mod = sco_edit_module.module_list(args={"module_id": modimpl.module_id})[0]
|
|
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"]
|
|
)
|
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(modimpl.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
|
|
|
|
#
|
|
sem_locked = not sem["etat"]
|
|
can_edit_evals = (
|
|
sco_permissions_check.can_edit_notes(
|
|
current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
|
|
)
|
|
and not sem_locked
|
|
)
|
|
can_edit_notes = (
|
|
sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
|
|
and not sem_locked
|
|
)
|
|
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
|
|
#
|
|
module_resp = User.query.get(M["responsable_id"])
|
|
mod_type_name = scu.MODULE_TYPE_NAMES[Mod["module_type"]]
|
|
H = [
|
|
html_sco_header.sco_header(
|
|
page_title=f"{mod_type_name} {Mod['code']} {Mod['titre']}"
|
|
),
|
|
f"""<h2 class="formsemestre">{mod_type_name}
|
|
<tt>{Mod['code']}</tt> {Mod['titre']}
|
|
{"dans l'UE " + modimpl.module.ue.acronyme if modimpl.module.module_type == scu.ModuleType.MALUS else ""}
|
|
</h2>
|
|
<div class="moduleimpl_tableaubord moduleimpl_type_{
|
|
scu.ModuleType(Mod['module_type']).name.lower()}">
|
|
<table>
|
|
<tr>
|
|
<td class="fichetitre2">Responsable: </td><td class="redboldtext">
|
|
{module_resp.get_nomcomplet()}
|
|
<span class="blacktt">({module_resp.user_name})</span>
|
|
""",
|
|
]
|
|
try:
|
|
sco_moduleimpl.can_change_module_resp(moduleimpl_id)
|
|
H.append(
|
|
"""<a class="stdlink" href="edit_moduleimpl_resp?moduleimpl_id=%s">modifier</a>"""
|
|
% moduleimpl_id
|
|
)
|
|
except:
|
|
pass
|
|
H.append("""</td><td>""")
|
|
H.append(
|
|
", ".join([sco_users.user_info(m["ens_id"])["nomprenom"] for m in M["ens"]])
|
|
)
|
|
H.append("""</td><td>""")
|
|
try:
|
|
sco_moduleimpl.can_change_ens(moduleimpl_id)
|
|
H.append(
|
|
"""<a class="stdlink" href="edit_enseignants_form?moduleimpl_id=%s">modifier les enseignants</a>"""
|
|
% moduleimpl_id
|
|
)
|
|
except:
|
|
pass
|
|
H.append("""</td></tr>""")
|
|
|
|
# 2ieme ligne: Semestre, Coef
|
|
H.append("""<tr><td class="fichetitre2">""")
|
|
if sem["semestre_id"] >= 0:
|
|
H.append("""Semestre: </td><td>%s""" % sem["semestre_id"])
|
|
else:
|
|
H.append("""</td><td>""")
|
|
if sem_locked:
|
|
H.append(scu.icontag("lock32_img", title="verrouillé"))
|
|
H.append("""</td><td class="fichetitre2">""")
|
|
if modimpl.module.is_apc():
|
|
H.append(_ue_coefs_html(modimpl.module.ue_coefs_list()))
|
|
else:
|
|
H.append(
|
|
f"""Coef. dans le semestre: {
|
|
"non défini" if modimpl.module.coefficient is None else modimpl.module.coefficient
|
|
}"""
|
|
)
|
|
H.append("""</td><td></td></tr>""")
|
|
# 3ieme ligne: Formation
|
|
H.append(
|
|
"""<tr><td class="fichetitre2">Formation: </td><td>%(titre)s</td></tr>""" % F
|
|
)
|
|
# Ligne: Inscrits
|
|
H.append(
|
|
"""<tr><td class="fichetitre2">Inscrits: </td><td> %d étudiants"""
|
|
% len(mod_inscrits)
|
|
)
|
|
if current_user.has_permission(Permission.ScoEtudInscrit):
|
|
H.append(
|
|
"""<a class="stdlink" style="margin-left:2em;" href="moduleimpl_inscriptions_edit?moduleimpl_id=%s">modifier</a>"""
|
|
% M["moduleimpl_id"]
|
|
)
|
|
H.append("</td></tr>")
|
|
# Ligne: règle de calcul
|
|
has_expression = sco_compute_moy.moduleimpl_has_expression(M)
|
|
if has_expression:
|
|
H.append(
|
|
'<tr><td class="fichetitre2" colspan="4">Règle de calcul: <span class="formula" title="mode de calcul de la moyenne du module">moyenne=<tt>%s</tt></span>'
|
|
% M["computation_expr"]
|
|
)
|
|
H.append("""<span class="warning">inutilisée dans cette version de ScoDoc""")
|
|
if sco_moduleimpl.can_change_ens(moduleimpl_id, raise_exc=False):
|
|
H.append(
|
|
f""" <a href="{
|
|
url_for("notes.delete_moduleimpl_expr", scodoc_dept=g.scodoc_dept,
|
|
moduleimpl_id=moduleimpl_id)
|
|
}" class="stdlink">supprimer</a>"""
|
|
)
|
|
H.append("""</span>""")
|
|
H.append("</td></tr>")
|
|
else:
|
|
H.append(
|
|
'<tr><td colspan="4">' # <em title="mode de calcul de la moyenne du module">règle de calcul standard</em>'
|
|
)
|
|
# if sco_moduleimpl.can_change_ens(moduleimpl_id, raise_exc=False):
|
|
# H.append(
|
|
# f' (<a class="stdlink" href="edit_moduleimpl_expr?moduleimpl_id={moduleimpl_id}">changer</a>)'
|
|
# )
|
|
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
|
|
)
|
|
# Adapté à partir d'une suggestion de DS (Le Havre)
|
|
# Liens saisies absences seulement si permission et date courante dans le semestre
|
|
if current_user.has_permission(
|
|
Permission.ScoAbsChange
|
|
) and sco_formsemestre.sem_est_courant(sem):
|
|
datelundi = sco_abs.ddmmyyyy(time.strftime("%d/%m/%Y")).prev_monday()
|
|
group_id = sco_groups.get_default_group(formsemestre_id)
|
|
H.append(
|
|
f"""
|
|
<span class="moduleimpl_abs_link"><a class="stdlink"
|
|
href="{url_for("absences.SignaleAbsenceGrHebdo",
|
|
scodoc_dept=g.scodoc_dept,formsemestre_id=formsemestre_id,
|
|
moduleimpl_id=moduleimpl_id, datelundi=datelundi, group_ids=group_id)}">
|
|
Saisie Absences hebdo.</a></span>
|
|
"""
|
|
)
|
|
|
|
H.append("</td></tr></table>")
|
|
#
|
|
if not modimpl.check_apc_conformity():
|
|
H.append(
|
|
"""<div class="warning conformite">Les poids des évaluations de ce module ne sont
|
|
pas encore conformes au PN.
|
|
Ses notes ne peuvent pas être prises en compte dans les moyennes d'UE.
|
|
</div>"""
|
|
)
|
|
#
|
|
if has_expression and nt.expr_diagnostics:
|
|
H.append(sco_formsemestre_status.html_expr_diagnostic(nt.expr_diagnostics))
|
|
#
|
|
if formsemestre_has_decisions(formsemestre_id):
|
|
H.append(
|
|
"""<ul class="tf-msg"><li class="tf-msg warning">Décisions de jury saisies: seul le responsable du semestre peut saisir des notes (il devra modifier les décisions de jury).</li></ul>"""
|
|
)
|
|
#
|
|
H.append(
|
|
"""<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)
|
|
)
|
|
#
|
|
# 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();">"""
|
|
)
|
|
been_selected = False
|
|
for partition in partitions:
|
|
if not partition_id and not been_selected:
|
|
selected = "selected"
|
|
been_selected = True
|
|
if partition["partition_id"] == partition_id:
|
|
selected = "selected"
|
|
else:
|
|
selected = ""
|
|
name = partition["partition_name"]
|
|
if name is None:
|
|
name = "Tous"
|
|
H.append(
|
|
"""<option value="%s" %s>%s</option>"""
|
|
% (partition["partition_id"], selected, name)
|
|
)
|
|
H.append(
|
|
"""</select>
|
|
|
|
<a class="stdlink" href="evaluation_listenotes?moduleimpl_id=%(moduleimpl_id)s">Voir toutes les notes</a>
|
|
</span>
|
|
</form>
|
|
</p>
|
|
"""
|
|
% M
|
|
)
|
|
|
|
# -------- Tableau des evaluations
|
|
top_table_links = ""
|
|
if can_edit_evals:
|
|
top_table_links = f"""<a class="stdlink" href="{
|
|
url_for("notes.evaluation_create", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'])
|
|
}">Créer nouvelle évaluation</a>
|
|
"""
|
|
if mod_evals:
|
|
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:
|
|
H.append(
|
|
'<div class="moduleimpl_evaluations_top_links">'
|
|
+ top_table_links
|
|
+ "</div>"
|
|
)
|
|
H.append("""<table class="moduleimpl_evaluations">""")
|
|
eval_index = len(mod_evals) - 1
|
|
first_eval = True
|
|
for eval_dict in mod_evals:
|
|
H.append(
|
|
_ligne_evaluation(
|
|
modimpl,
|
|
eval_dict,
|
|
first_eval=first_eval,
|
|
partition_id=partition_id,
|
|
arrow_down=arrow_down,
|
|
arrow_none=arrow_none,
|
|
arrow_up=arrow_up,
|
|
can_edit_evals=can_edit_evals,
|
|
can_edit_notes=can_edit_notes,
|
|
eval_index=eval_index,
|
|
nb_evals=len(mod_evals),
|
|
is_apc=nt.is_apc,
|
|
)
|
|
)
|
|
eval_index -= 1
|
|
first_eval = False
|
|
#
|
|
H.append("""<tr><td colspan="8">""")
|
|
if sem_locked:
|
|
H.append(f"""{scu.icontag("lock32_img")} semestre verrouillé""")
|
|
elif can_edit_evals:
|
|
H.append(top_table_links)
|
|
|
|
H.append(
|
|
f"""</td></tr>
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<!-- LEGENDE -->
|
|
<hr>
|
|
<h4>Légende</h4>
|
|
<ul>
|
|
<li>{scu.icontag("edit_img")} : modifie description de l'évaluation
|
|
(date, heure, coefficient, ...)
|
|
</li>
|
|
<li>{scu.icontag("notes_img")} : saisie des notes</li>
|
|
<li>{scu.icontag("delete_img")} : indique qu'il n'y a aucune note
|
|
entrée (cliquer pour supprimer cette évaluation)
|
|
</li>
|
|
<li>{scu.icontag("status_orange_img")} : indique qu'il manque
|
|
quelques notes dans cette évaluation
|
|
</li>
|
|
<li>{scu.icontag("status_green_img")} : toutes les notes sont
|
|
entrées (cliquer pour les afficher)
|
|
</li>
|
|
<li>{scu.icontag("status_visible_img")} : indique que cette évaluation
|
|
sera mentionnée dans les bulletins au format "intermédiaire"
|
|
</li>
|
|
</ul>
|
|
|
|
<p>Rappel : seules les notes des évaluations complètement saisies
|
|
(affichées en vert) apparaissent dans les bulletins.
|
|
</p>
|
|
"""
|
|
)
|
|
H.append(html_sco_header.sco_footer())
|
|
return "".join(H)
|
|
|
|
|
|
def _ligne_evaluation(
|
|
modimpl: ModuleImpl,
|
|
eval_dict: dict,
|
|
first_eval: bool = True,
|
|
partition_id=None,
|
|
arrow_down=None,
|
|
arrow_none=None,
|
|
arrow_up=None,
|
|
can_edit_evals: bool = False,
|
|
can_edit_notes: bool = False,
|
|
eval_index: int = 0,
|
|
nb_evals: int = 0,
|
|
is_apc=False,
|
|
) -> 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"])
|
|
etat = sco_evaluations.do_evaluation_etat(
|
|
evaluation.id,
|
|
partition_id=partition_id,
|
|
select_first_partition=True,
|
|
)
|
|
if evaluation.evaluation_type in (
|
|
scu.EVALUATION_RATTRAPAGE,
|
|
scu.EVALUATION_SESSION2,
|
|
):
|
|
tr_class = "mievr mievr_rattr"
|
|
else:
|
|
tr_class = "mievr"
|
|
tr_class_1 = "mievr"
|
|
if not first_eval:
|
|
H.append("""<tr><td colspan="8"> </td></tr>""")
|
|
tr_class_1 += " mievr_spaced"
|
|
H.append(f"""<tr class="{tr_class_1}"><td class="mievr_tit" colspan="8">""")
|
|
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("""<span class="eval_warning_coef">coef. nul !</span>""")
|
|
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()}"""
|
|
)
|
|
else:
|
|
H.append(
|
|
f"""<a href="{url_for("notes.evaluation_edit",
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}" class="mievr_evalnodate">Évaluation sans date</a>"""
|
|
)
|
|
H.append(f" <em>{evaluation.description or ''}</em>")
|
|
if evaluation.evaluation_type == scu.EVALUATION_RATTRAPAGE:
|
|
H.append(
|
|
"""<span class="mievr_rattr" title="remplace si meilleure note">rattrapage</span>"""
|
|
)
|
|
elif evaluation.evaluation_type == scu.EVALUATION_SESSION2:
|
|
H.append(
|
|
"""<span class="mievr_rattr" title="remplace autres notes">session 2</span>"""
|
|
)
|
|
#
|
|
if etat["last_modif"]:
|
|
H.append(
|
|
f"""<span class="mievr_lastmodif">(dernière modif le {
|
|
etat["last_modif"].strftime("%d/%m/%Y à %Hh%M")})</span>"""
|
|
)
|
|
#
|
|
H.append(
|
|
f"""<span class="evalindex_cont">
|
|
<span class="evalindex" title="Indice dans les vecteurs (formules)">{
|
|
eval_index:2}</span>
|
|
<span class="eval_arrows_chld">
|
|
"""
|
|
)
|
|
# Fleches:
|
|
if eval_index != (nb_evals - 1) and can_edit_evals:
|
|
H.append(
|
|
f"""<a href="{url_for("notes.module_evaluation_move",
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id, after=0)
|
|
}" class="aud">{arrow_up}</a>"""
|
|
)
|
|
else:
|
|
H.append(arrow_none)
|
|
if (eval_index > 0) and can_edit_evals:
|
|
H.append(
|
|
f"""<a href="{url_for("notes.module_evaluation_move",
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id, after=1)
|
|
}" class="aud">{arrow_down}</a>"""
|
|
)
|
|
else:
|
|
H.append(arrow_none)
|
|
|
|
H.append(
|
|
f"""</span></span></td>
|
|
</tr>
|
|
<tr class="{tr_class}">
|
|
<th class="moduleimpl_evaluations" colspan="2"> </th>
|
|
<th class="moduleimpl_evaluations">Durée</th>
|
|
<th class="moduleimpl_evaluations">Coef.</th>
|
|
<th class="moduleimpl_evaluations">Notes</th>
|
|
<th class="moduleimpl_evaluations">Abs</th>
|
|
<th class="moduleimpl_evaluations">N</th>
|
|
<th class="moduleimpl_evaluations">Moyenne """
|
|
)
|
|
|
|
if etat["evalcomplete"]:
|
|
etat_txt = """(prise en compte)"""
|
|
etat_descr = "notes utilisées dans les moyennes"
|
|
elif eval_dict["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"
|
|
)
|
|
elif etat["nb_notes"] != 0:
|
|
etat_txt = "(<b>non</b> prise en compte)"
|
|
etat_descr = "il manque des notes"
|
|
else:
|
|
etat_txt = ""
|
|
if can_edit_evals and etat_txt:
|
|
etat_txt = f"""<a href="{ url_for("notes.evaluation_edit",
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}" title="{etat_descr}">{etat_txt}</a>"""
|
|
|
|
H.append(
|
|
f"""{etat_txt}</th>
|
|
</tr>
|
|
<tr class="{tr_class}"><td class="mievr">"""
|
|
)
|
|
if can_edit_evals:
|
|
H.append(
|
|
f"""<a class="smallbutton" href="{url_for('notes.evaluation_edit',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">{scu.icontag("edit_img", alt="modifier", title="Modifier informations")}</a>"""
|
|
)
|
|
if can_edit_notes:
|
|
H.append(
|
|
f"""<a class="smallbutton" href="{url_for('notes.saisie_notes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">{scu.icontag("notes_img", alt="saisie notes", title="Saisie des notes")}</a>"""
|
|
)
|
|
if etat["nb_notes"] == 0:
|
|
if can_edit_evals:
|
|
H.append(
|
|
f"""<a class="smallbutton" href="{url_for('notes.evaluation_delete',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">"""
|
|
)
|
|
H.append(scu.icontag("delete_img", alt="supprimer", title="Supprimer"))
|
|
if can_edit_evals:
|
|
H.append("""</a>""")
|
|
elif etat["evalcomplete"]:
|
|
H.append(
|
|
f"""<a class="smallbutton" href="{url_for('notes.evaluation_listenotes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">{scu.icontag("status_green_img", title="ok")}</a>"""
|
|
)
|
|
else:
|
|
if etat["evalattente"]:
|
|
H.append(
|
|
f"""<a class="smallbutton" href="{url_for('notes.evaluation_listenotes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">{scu.icontag(
|
|
"status_greenorange_img",
|
|
file_format="gif",
|
|
title="notes en attente",
|
|
)}</a>"""
|
|
)
|
|
else:
|
|
H.append(
|
|
f"""<a class="smallbutton" href="{url_for('notes.evaluation_listenotes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">{scu.icontag("status_orange_img", title="il manque des notes")}</a>"""
|
|
)
|
|
#
|
|
if eval_dict["visibulletin"]:
|
|
H.append(
|
|
scu.icontag(
|
|
"status_visible_img", title="visible dans bulletins intermédiaires"
|
|
)
|
|
)
|
|
else:
|
|
H.append(" ")
|
|
H.append('</td><td class="mievr_menu">')
|
|
if can_edit_notes:
|
|
H.append(
|
|
moduleimpl_evaluation_menu(
|
|
evaluation.id,
|
|
nbnotes=etat["nb_notes"],
|
|
)
|
|
)
|
|
#
|
|
H.append(
|
|
f"""</td>
|
|
<td class="mievr_dur">{eval_dict["duree"]}</td>
|
|
<td class="rightcell mievr_coef">{eval_dict["coefficient"]:g}</td>
|
|
"""
|
|
)
|
|
H.append(
|
|
f"""
|
|
<td class="rightcell mievr_nbnotes">{etat["nb_notes"]} / {etat["nb_inscrits"]}</td>
|
|
<td class="rightcell mievr_coef">{etat["nb_abs"]}</td>
|
|
<td class="rightcell mievr_coef">{etat["nb_neutre"]}</td>
|
|
<td class="rightcell">"""
|
|
% etat
|
|
)
|
|
if etat["moy"]:
|
|
H.append(
|
|
f"""<b>{etat["moy"]} / {eval_dict["note_max"]:g}</b>
|
|
(<a class="stdlink" href="{
|
|
url_for('notes.evaluation_listenotes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">afficher</a>)"""
|
|
)
|
|
else:
|
|
H.append(
|
|
f"""<a class="redlink" href="{url_for('notes.saisie_notes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
}">saisir notes</a>
|
|
"""
|
|
)
|
|
H.append("""</td></tr>""")
|
|
#
|
|
if etat["nb_notes"] == 0:
|
|
H.append(f"""<tr class="{tr_class}"><td></td>""")
|
|
if modimpl.module.is_apc():
|
|
H.append(
|
|
f"""<td colspan="7" class="eval_poids">{
|
|
evaluation.get_ue_poids_str()}</td>"""
|
|
)
|
|
else:
|
|
H.append('<td colspan="7"></td>')
|
|
H.append("""</tr>""")
|
|
else: # il y a deja des notes saisies
|
|
gr_moyennes = etat["gr_moyennes"]
|
|
first_group = True
|
|
for gr_moyenne in gr_moyennes:
|
|
H.append(f"""<tr class="{tr_class}"><td> </td>""")
|
|
if first_group and modimpl.module.is_apc():
|
|
H.append(
|
|
f"""<td class="eval_poids" colspan="3">{
|
|
evaluation.get_ue_poids_str()}</td>"""
|
|
)
|
|
else:
|
|
H.append("""<td colspan="3"></td>""")
|
|
first_group = False
|
|
if gr_moyenne["group_name"] is None:
|
|
name = "Tous" # tous
|
|
else:
|
|
name = f"""Groupe {gr_moyenne["group_name"]}"""
|
|
H.append(f"""<td colspan="3" class="mievr_grtit">{name} </td><td>""")
|
|
if gr_moyenne["gr_nb_notes"] > 0:
|
|
H.append(
|
|
f"""{gr_moyenne["gr_moy"]} (<a href="{
|
|
url_for('notes.evaluation_listenotes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id,
|
|
tf_submitted=1, **{'group_ids:list': gr_moyenne["group_id"]})
|
|
}">{gr_moyenne["gr_nb_notes"]} notes</a>"""
|
|
)
|
|
if gr_moyenne["gr_nb_att"] > 0:
|
|
H.append(
|
|
f""", <span class="redboldtext">{
|
|
gr_moyenne["gr_nb_att"]} en attente</span>"""
|
|
)
|
|
H.append(""")""")
|
|
if gr_moyenne["group_id"] in etat["gr_incomplets"]:
|
|
H.append("""[<font color="red">""")
|
|
if can_edit_notes:
|
|
H.append(
|
|
f"""<a class="redlink" href="{url_for('notes.saisie_notes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id,
|
|
**{'group_ids:list': gr_moyenne["group_id"]})
|
|
}">incomplet</a></font>]"""
|
|
)
|
|
else:
|
|
H.append("""incomplet</font>]""")
|
|
else:
|
|
H.append("""<span class="redboldtext"> """)
|
|
if can_edit_notes:
|
|
H.append(
|
|
f"""<a class="redlink" href="{url_for('notes.saisie_notes',
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id,
|
|
**{'group_ids:list': gr_moyenne["group_id"]})
|
|
}"""
|
|
)
|
|
H.append("pas de notes")
|
|
if can_edit_notes:
|
|
H.append("""</a>""")
|
|
H.append("</span>")
|
|
H.append("""</td></tr>""")
|
|
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 = (
|
|
"""<div class="evaluation_poids">"""
|
|
+ "\n".join(
|
|
[
|
|
f"""<div title="poids vers {ue.acronyme}: {poids:g}"><div style="--size:{math.sqrt(poids/max_poids*144)}px;
|
|
{'background-color: ' + ue.color + ';' if ue.color else ''}
|
|
"></div></div>"""
|
|
for ue, poids in (
|
|
(UniteEns.query.get(ue_id), poids)
|
|
for ue_id, poids in ue_poids.items()
|
|
)
|
|
]
|
|
)
|
|
+ "</div>"
|
|
)
|
|
return H
|