2020-09-26 16:19:37 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# Gestion scolarite IUT
|
|
|
|
#
|
2023-12-31 23:04:06 +01:00
|
|
|
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2024-03-15 15:56:33 +01:00
|
|
|
"""Tableau de bord module"""
|
|
|
|
|
2022-10-02 18:43:18 +02:00
|
|
|
import math
|
2023-09-01 15:24:44 +02:00
|
|
|
import datetime
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-07-19 18:03:24 +02:00
|
|
|
from flask import g, render_template, url_for
|
2021-07-31 18:01:10 +02:00
|
|
|
from flask_login import current_user
|
2021-07-20 06:53:05 +02:00
|
|
|
|
2024-10-18 23:49:39 +02:00
|
|
|
from app import db, log
|
2021-12-19 11:08:03 +01:00
|
|
|
from app.auth.models import User
|
2022-02-10 15:29:51 +01:00
|
|
|
from app.comp import res_sem
|
2023-02-10 22:04:09 +01:00
|
|
|
from app.comp.res_common import ResultatsSemestre
|
2022-03-27 22:25:00 +02:00
|
|
|
from app.comp.res_compat import NotesTableCompat
|
2023-02-20 21:04:29 +01:00
|
|
|
from app.models import Evaluation, FormSemestre, Module, ModuleImpl, UniteEns
|
2021-06-19 23:21:37 +02:00
|
|
|
import app.scodoc.sco_utils as scu
|
2024-07-09 15:23:36 +02:00
|
|
|
from app.scodoc import sco_assiduites as scass
|
2023-02-12 13:36:47 +01:00
|
|
|
from app.scodoc.codes_cursus import UE_SPORT
|
2022-07-07 16:24:52 +02:00
|
|
|
from app.scodoc.sco_cursus_dut import formsemestre_has_decisions
|
2024-10-18 23:49:39 +02:00
|
|
|
from app.scodoc.sco_exceptions import ScoValueError
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
2021-01-17 22:31:28 +01:00
|
|
|
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import htmlutils
|
|
|
|
from app.scodoc import sco_evaluations
|
|
|
|
from app.scodoc import sco_groups
|
|
|
|
from app.scodoc import sco_moduleimpl
|
2023-02-10 22:04:09 +01:00
|
|
|
from app.tables import list_etuds
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-05-30 17:16:07 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
# menu evaluation dans moduleimpl
|
2023-08-30 08:53:36 +02:00
|
|
|
def moduleimpl_evaluation_menu(evaluation: Evaluation, nbnotes: int = 0) -> str:
|
2020-09-26 16:19:37 +02:00
|
|
|
"Menu avec actions sur une evaluation"
|
2023-08-30 08:53:36 +02:00
|
|
|
modimpl: ModuleImpl = evaluation.moduleimpl
|
|
|
|
group_id = sco_groups.get_default_group(modimpl.formsemestre_id)
|
|
|
|
evaluation_id = evaluation.id
|
|
|
|
can_edit_notes = modimpl.can_edit_notes(current_user, allow_ens=False)
|
|
|
|
can_edit_notes_ens = modimpl.can_edit_notes(current_user)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-08-30 08:53:36 +02:00
|
|
|
if can_edit_notes and nbnotes != 0:
|
2024-05-20 23:28:39 +02:00
|
|
|
sup_label = "Suppression évaluation impossible (il y a des notes)"
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
sup_label = "Supprimer évaluation"
|
|
|
|
|
2024-07-09 15:23:36 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.get_formsemestre(modimpl.formsemestre_id)
|
|
|
|
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
|
|
|
|
|
2023-02-20 21:04:29 +01:00
|
|
|
menu_eval = [
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
2024-06-14 20:15:20 +02:00
|
|
|
"title": "Saisir les notes",
|
2024-08-25 07:23:36 +02:00
|
|
|
"endpoint": "notes.form_saisie_notes",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation_id,
|
|
|
|
},
|
2023-08-30 08:53:36 +02:00
|
|
|
"enabled": can_edit_notes_ens,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
2024-06-14 20:15:20 +02:00
|
|
|
{
|
|
|
|
"title": "Saisir par fichier tableur",
|
|
|
|
"id": "menu_saisie_tableur",
|
|
|
|
"endpoint": "notes.saisie_notes_tableur",
|
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation.id,
|
|
|
|
},
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Modifier évaluation",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.evaluation_edit",
|
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation_id,
|
|
|
|
},
|
2023-08-30 08:53:36 +02:00
|
|
|
"enabled": can_edit_notes,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": sup_label,
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.evaluation_delete",
|
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation_id,
|
|
|
|
},
|
2023-08-30 08:53:36 +02:00
|
|
|
"enabled": nbnotes == 0 and can_edit_notes,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Supprimer toutes les notes",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.evaluation_suppress_alln",
|
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation_id,
|
|
|
|
},
|
2023-08-30 08:53:36 +02:00
|
|
|
"enabled": can_edit_notes,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Afficher les notes",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.evaluation_listenotes",
|
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation_id,
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": nbnotes > 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Placement étudiants",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.placement_eval_selectetuds",
|
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation_id,
|
|
|
|
},
|
2023-08-30 08:53:36 +02:00
|
|
|
"enabled": can_edit_notes_ens,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Absences ce jour",
|
2023-08-30 08:53:36 +02:00
|
|
|
"endpoint": "assiduites.etat_abs_date",
|
2021-06-19 23:21:37 +02:00
|
|
|
"args": {
|
|
|
|
"group_ids": group_id,
|
2023-12-09 15:53:45 +01:00
|
|
|
"evaluation_id": evaluation.id,
|
2024-02-14 21:45:58 +01:00
|
|
|
"date_debut": (
|
|
|
|
evaluation.date_debut.isoformat() if evaluation.date_debut else ""
|
|
|
|
),
|
|
|
|
"date_fin": (
|
|
|
|
evaluation.date_fin.isoformat() if evaluation.date_fin else ""
|
|
|
|
),
|
2021-06-19 23:21:37 +02:00
|
|
|
},
|
2024-01-22 13:38:04 +01:00
|
|
|
"enabled": evaluation.date_debut is not None
|
2024-07-09 15:23:36 +02:00
|
|
|
and evaluation.date_fin is not None
|
|
|
|
and not disable_abs,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Vérifier notes vs absents",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.evaluation_check_absences_html",
|
|
|
|
"args": {
|
|
|
|
"evaluation_id": evaluation_id,
|
|
|
|
},
|
2024-07-09 15:23:36 +02:00
|
|
|
"enabled": nbnotes > 0
|
|
|
|
and evaluation.date_debut is not None
|
|
|
|
and not disable_abs,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2023-02-20 21:04:29 +01:00
|
|
|
return htmlutils.make_menu("actions", menu_eval, alone=True)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2024-05-29 11:55:28 +02:00
|
|
|
def _ue_coefs_html(modimpl: ModuleImpl) -> str:
|
2021-12-02 21:16:14 +01:00
|
|
|
""" """
|
2024-05-29 11:55:28 +02:00
|
|
|
coefs_lst = modimpl.module.ue_coefs_list()
|
|
|
|
max_coef = max(x[1] for x in coefs_lst) if coefs_lst else 1.0
|
|
|
|
H = f"""
|
2021-12-02 21:16:14 +01:00
|
|
|
<div id="modimpl_coefs">
|
2024-05-29 11:55:28 +02:00
|
|
|
<div>Coefficients vers les UEs
|
|
|
|
<span><a class="stdlink" href="{
|
|
|
|
url_for(
|
|
|
|
"notes.edit_modules_ue_coefs",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formation_id=modimpl.module.formation.id,
|
|
|
|
semestre_idx=modimpl.formsemestre.semestre_id,
|
|
|
|
)
|
|
|
|
}">détail</a>
|
|
|
|
</span>
|
|
|
|
</div>
|
2021-12-02 21:16:14 +01:00
|
|
|
"""
|
2024-05-29 11:55:28 +02:00
|
|
|
|
2022-01-06 22:42:26 +01:00
|
|
|
if coefs_lst:
|
2024-05-29 11:55:28 +02:00
|
|
|
H += _html_hinton_map(
|
|
|
|
colors=(uc[0].color for uc in coefs_lst),
|
|
|
|
max_val=max_coef,
|
|
|
|
size=36,
|
|
|
|
title=modimpl.module.get_ue_coefs_descr(),
|
|
|
|
values=(uc[1] for uc in coefs_lst),
|
2021-12-02 21:16:14 +01:00
|
|
|
)
|
2024-05-29 11:55:28 +02:00
|
|
|
# (
|
|
|
|
# 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
|
|
|
|
# if coef > 0
|
|
|
|
# ]
|
|
|
|
# )
|
|
|
|
# + "</div>"
|
|
|
|
# )
|
2021-12-02 21:16:14 +01:00
|
|
|
else:
|
2022-01-06 22:42:26 +01:00
|
|
|
H += """<div class="missing_value">non définis</div>"""
|
|
|
|
H += "</div>"
|
2021-12-02 21:16:14 +01:00
|
|
|
return H
|
|
|
|
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Tableau de bord module (liste des evaluations etc)"""
|
2024-06-13 22:03:17 +02:00
|
|
|
modimpl: ModuleImpl = ModuleImpl.get_modimpl(moduleimpl_id)
|
2023-07-31 16:14:16 +02:00
|
|
|
g.current_moduleimpl_id = modimpl.id
|
2023-02-20 21:04:29 +01:00
|
|
|
module: Module = modimpl.module
|
2022-04-29 08:17:04 +02:00
|
|
|
formsemestre_id = modimpl.formsemestre_id
|
2022-11-09 12:50:10 +01:00
|
|
|
formsemestre: FormSemestre = modimpl.formsemestre
|
2021-11-12 22:17:46 +01:00
|
|
|
mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list(
|
2022-12-15 17:09:35 +01:00
|
|
|
moduleimpl_id=moduleimpl_id
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
2022-11-09 12:50:10 +01:00
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
2023-08-25 17:58:57 +02:00
|
|
|
# Evaluations, par numéros ou la plus RECENTE en tête
|
2022-12-15 17:09:35 +01:00
|
|
|
evaluations = modimpl.evaluations.order_by(
|
|
|
|
Evaluation.numero.desc(),
|
2023-08-25 17:58:57 +02:00
|
|
|
Evaluation.date_debut.desc(),
|
2022-12-15 17:09:35 +01:00
|
|
|
).all()
|
|
|
|
nb_evaluations = len(evaluations)
|
2024-05-29 12:12:31 +02:00
|
|
|
# Le poids max pour chaque catégorie d'évaluation
|
|
|
|
max_poids_by_type: dict[int, float] = {}
|
|
|
|
for eval_type in (
|
|
|
|
Evaluation.EVALUATION_NORMALE,
|
|
|
|
Evaluation.EVALUATION_RATTRAPAGE,
|
|
|
|
Evaluation.EVALUATION_SESSION2,
|
|
|
|
Evaluation.EVALUATION_BONUS,
|
|
|
|
):
|
|
|
|
max_poids_by_type[eval_type] = max(
|
|
|
|
[
|
|
|
|
max([p.poids for p in e.ue_poids] or [0]) * (e.coefficient or 0.0)
|
|
|
|
for e in evaluations
|
|
|
|
if e.evaluation_type == eval_type
|
|
|
|
]
|
|
|
|
or [0.0]
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
2023-02-20 21:04:29 +01:00
|
|
|
sem_locked = not formsemestre.etat
|
2022-04-28 07:06:01 +02:00
|
|
|
can_edit_evals = (
|
2024-02-04 23:08:08 +01:00
|
|
|
modimpl.can_edit_notes(current_user, allow_ens=formsemestre.ens_can_edit_eval)
|
2022-04-28 07:06:01 +02:00
|
|
|
and not sem_locked
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-04 23:08:08 +01:00
|
|
|
can_edit_notes = modimpl.can_edit_notes(current_user) and not sem_locked
|
2021-10-12 16:05:50 +02:00
|
|
|
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
2023-07-11 06:57:38 +02:00
|
|
|
module_resp = db.session.get(User, modimpl.responsable_id)
|
2024-10-18 23:49:39 +02:00
|
|
|
if module_resp is None:
|
|
|
|
# l'utilisateur a été supprimé par erreur
|
|
|
|
# ré-affecte le module au 1er resp. du semestre
|
|
|
|
if modimpl.formsemestre.responsables:
|
|
|
|
log(
|
|
|
|
f"""Modimpl resp. {modimpl} suppressed: affecting to {
|
|
|
|
modimpl.formsemestre.responsables[0]}"""
|
|
|
|
)
|
|
|
|
modimpl.responsable_id = modimpl.formsemestre.responsables[0].id
|
|
|
|
db.session.add(modimpl)
|
|
|
|
db.session.commit()
|
|
|
|
else:
|
|
|
|
raise ScoValueError(
|
|
|
|
"Module et semestre sans responsables: contacter l'assistance"
|
|
|
|
)
|
|
|
|
|
2023-02-20 21:04:29 +01:00
|
|
|
mod_type_name = scu.MODULE_TYPE_NAMES[module.module_type]
|
2020-09-26 16:19:37 +02:00
|
|
|
H = [
|
2023-02-20 21:04:29 +01:00
|
|
|
f"""<h2 class="formsemestre">{mod_type_name}
|
|
|
|
<tt>{module.code}</tt> {module.titre}
|
|
|
|
{"dans l'UE " + modimpl.module.ue.acronyme
|
|
|
|
if modimpl.module.module_type == scu.ModuleType.MALUS
|
2023-02-10 22:04:09 +01:00
|
|
|
else ""
|
|
|
|
}
|
2022-02-01 11:37:05 +01:00
|
|
|
</h2>
|
2021-11-12 22:17:46 +01:00
|
|
|
<div class="moduleimpl_tableaubord moduleimpl_type_{
|
2023-02-20 21:04:29 +01:00
|
|
|
scu.ModuleType(module.module_type).name.lower()}">
|
2021-11-12 22:17:46 +01:00
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td class="fichetitre2">Responsable: </td><td class="redboldtext">
|
|
|
|
{module_resp.get_nomcomplet()}
|
|
|
|
<span class="blacktt">({module_resp.user_name})</span>
|
|
|
|
""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2024-02-03 23:25:05 +01:00
|
|
|
if modimpl.can_change_responsable(current_user):
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2023-02-10 22:04:09 +01:00
|
|
|
f"""<a class="stdlink" href="{url_for("notes.edit_moduleimpl_resp",
|
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
|
|
|
|
}" >modifier</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append("""</td><td>""")
|
2023-02-10 22:04:09 +01:00
|
|
|
H.append(", ".join([u.get_nomprenom() for u in modimpl.enseignants]))
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("""</td><td>""")
|
2024-02-03 23:25:05 +01:00
|
|
|
if modimpl.can_change_ens(raise_exc=False):
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-02-03 23:25:05 +01:00
|
|
|
f"""<a class="stdlink" href="{
|
|
|
|
url_for("notes.edit_enseignants_form",
|
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id
|
|
|
|
)
|
|
|
|
}">modifier les enseignants</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-03 23:25:05 +01:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("""</td></tr>""")
|
|
|
|
|
|
|
|
# 2ieme ligne: Semestre, Coef
|
|
|
|
H.append("""<tr><td class="fichetitre2">""")
|
2023-02-20 21:04:29 +01:00
|
|
|
if formsemestre.semestre_id >= 0:
|
2024-04-02 23:37:23 +02:00
|
|
|
H.append(f"""Semestre: </td><td>{formsemestre.semestre_id}""")
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
H.append("""</td><td>""")
|
2022-04-28 07:06:01 +02:00
|
|
|
if sem_locked:
|
2021-01-17 22:31:28 +01:00
|
|
|
H.append(scu.icontag("lock32_img", title="verrouillé"))
|
2021-12-02 21:16:14 +01:00
|
|
|
H.append("""</td><td class="fichetitre2">""")
|
2021-11-29 22:18:37 +01:00
|
|
|
if modimpl.module.is_apc():
|
2024-05-29 11:55:28 +02:00
|
|
|
H.append(_ue_coefs_html(modimpl))
|
2021-11-29 22:18:37 +01:00
|
|
|
else:
|
2022-06-02 11:37:13 +02:00
|
|
|
H.append(
|
|
|
|
f"""Coef. dans le semestre: {
|
2023-02-20 21:04:29 +01:00
|
|
|
"non défini" if modimpl.module.coefficient is None else modimpl.module.coefficient
|
2022-06-02 11:37:13 +02:00
|
|
|
}"""
|
|
|
|
)
|
2021-11-29 22:18:37 +01:00
|
|
|
H.append("""</td><td></td></tr>""")
|
2020-09-26 16:19:37 +02:00
|
|
|
# 3ieme ligne: Formation
|
|
|
|
H.append(
|
2023-02-20 21:04:29 +01:00
|
|
|
f"""<tr>
|
|
|
|
<td class="fichetitre2">Formation: </td><td>{formsemestre.formation.titre}</td>
|
|
|
|
</tr>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
# Ligne: Inscrits
|
|
|
|
H.append(
|
2023-02-20 21:04:29 +01:00
|
|
|
f"""<tr><td class="fichetitre2">Inscrits: </td><td> {len(mod_inscrits)} étudiants"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-06-13 22:03:17 +02:00
|
|
|
if modimpl.can_change_inscriptions(raise_exc=False):
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-04-02 23:37:23 +02:00
|
|
|
f"""<a class="stdlink" style="margin-left:2em;"
|
2024-06-13 22:03:17 +02:00
|
|
|
href="{
|
|
|
|
url_for("notes.moduleimpl_inscriptions_edit",
|
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl.id
|
|
|
|
)}">modifier</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-07-19 10:19:30 +02:00
|
|
|
H.append(
|
|
|
|
"""</td></tr>
|
|
|
|
<tr><td colspan="4"></td></tr>
|
|
|
|
"""
|
|
|
|
)
|
2024-07-09 15:23:36 +02:00
|
|
|
|
|
|
|
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
|
|
|
|
|
|
|
|
if not disable_abs:
|
|
|
|
H.append(
|
|
|
|
f"""<tr><td colspan="4"><span class="moduleimpl_abs_link"><a class="stdlink"
|
2022-12-15 17:09:35 +01:00
|
|
|
href="{
|
|
|
|
url_for("notes.view_module_abs", scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
|
|
|
|
}">Absences dans ce module</a></span>"""
|
2024-07-09 15:23:36 +02:00
|
|
|
)
|
2021-01-02 22:07:38 +01:00
|
|
|
# Adapté à partir d'une suggestion de DS (Le Havre)
|
|
|
|
# Liens saisies absences seulement si permission et date courante dans le semestre
|
2024-07-09 15:23:36 +02:00
|
|
|
if (
|
|
|
|
current_user.has_permission(Permission.AbsChange)
|
|
|
|
and formsemestre.est_courant()
|
|
|
|
and not disable_abs
|
|
|
|
):
|
2021-07-29 16:31:15 +02:00
|
|
|
group_id = sco_groups.get_default_group(formsemestre_id)
|
2021-01-02 22:07:38 +01:00
|
|
|
H.append(
|
2021-07-20 06:53:05 +02:00
|
|
|
f"""
|
2023-09-01 15:24:44 +02:00
|
|
|
<span class="moduleimpl_abs_link"><a class="stdlink" href="{
|
|
|
|
url_for("assiduites.signal_assiduites_group", scodoc_dept=g.scodoc_dept)
|
2024-05-30 10:51:24 +02:00
|
|
|
}?group_ids={group_id}&day={
|
2023-09-01 15:24:44 +02:00
|
|
|
datetime.date.today().isoformat()
|
|
|
|
}&formsemestre_id={formsemestre.id}
|
|
|
|
&moduleimpl_id={moduleimpl_id}
|
|
|
|
"
|
2024-05-29 16:29:34 +02:00
|
|
|
>Saisie Absences</a></span>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
current_week: str = datetime.datetime.now().strftime("%G-W%V")
|
|
|
|
H.append(
|
|
|
|
f"""
|
|
|
|
<span class="moduleimpl_abs_link"><a class="stdlink" href="{
|
|
|
|
url_for("assiduites.signal_assiduites_hebdo",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
group_ids=group_id,
|
|
|
|
week=current_week,
|
|
|
|
moduleimpl_id=moduleimpl_id
|
|
|
|
)
|
|
|
|
}
|
|
|
|
"
|
|
|
|
>Saisie Absences (Hebdo)</a></span>
|
2023-09-06 15:09:43 +02:00
|
|
|
"""
|
|
|
|
)
|
2021-01-02 22:07:38 +01:00
|
|
|
H.append("</td></tr></table>")
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
2022-12-17 21:27:14 +01:00
|
|
|
if not modimpl.check_apc_conformity(nt):
|
2021-11-29 22:18:37 +01:00
|
|
|
H.append(
|
2024-05-20 23:28:39 +02:00
|
|
|
"""<div class="warning conformite">Les poids des évaluations de ce
|
|
|
|
module ne permettent pas d'évaluer toutes les UEs (compétences)
|
|
|
|
prévues par les coefficients du programme.
|
|
|
|
<b>Ses notes ne peuvent pas être prises en compte dans les moyennes d'UE.</b>
|
|
|
|
Vérifiez les poids des évaluations.
|
|
|
|
</div>"""
|
|
|
|
)
|
|
|
|
if not modimpl.check_apc_conformity(
|
|
|
|
nt, evaluation_type=Evaluation.EVALUATION_SESSION2
|
|
|
|
):
|
|
|
|
H.append(
|
|
|
|
"""<div class="warning conformite">
|
|
|
|
Il y a des évaluations de <b>deuxième session</b>
|
|
|
|
mais leurs poids ne permettent pas d'évaluer toutes les UEs (compétences)
|
|
|
|
prévues par les coefficients du programme.
|
2024-05-21 20:43:45 +02:00
|
|
|
La deuxième session ne sera donc <b>pas prise en compte</b>.
|
|
|
|
Vérifiez les poids de ces évaluations.
|
|
|
|
</div>"""
|
|
|
|
)
|
|
|
|
if not modimpl.check_apc_conformity(
|
|
|
|
nt, evaluation_type=Evaluation.EVALUATION_RATTRAPAGE
|
|
|
|
):
|
|
|
|
H.append(
|
|
|
|
"""<div class="warning conformite">
|
|
|
|
Il y a des évaluations de <b>rattrapage</b>
|
|
|
|
mais leurs poids n'évaluent pas toutes les UEs (compétences)
|
|
|
|
prévues par les coefficients du programme.
|
2024-05-20 23:28:39 +02:00
|
|
|
Vérifiez les poids de ces évaluations.
|
2022-01-06 22:42:26 +01:00
|
|
|
</div>"""
|
2021-11-29 22:18:37 +01:00
|
|
|
)
|
2024-02-14 21:45:58 +01:00
|
|
|
|
2022-02-10 15:29:51 +01:00
|
|
|
if formsemestre_has_decisions(formsemestre_id):
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-02-27 21:10:55 +01:00
|
|
|
"""<div class="formsemestre-warning-box">
|
|
|
|
<div class="warning">Décisions de jury saisies: seul le ou la responsable du
|
2023-11-15 12:31:28 +01:00
|
|
|
semestre peut saisir des notes (elle devra modifier les décisions de jury).
|
2024-02-27 21:10:55 +01:00
|
|
|
</div>
|
|
|
|
</div>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
#
|
|
|
|
H.append(
|
2023-02-10 22:04:09 +01:00
|
|
|
f"""<p><form name="f">
|
|
|
|
<span style="font-size:120%%; font-weight: bold;">{nb_evaluations} évaluations :</span>
|
2020-09-26 16:19:37 +02:00
|
|
|
<span style="padding-left: 30px;">
|
2023-02-10 22:04:09 +01:00
|
|
|
<input type="hidden" name="moduleimpl_id" value="{moduleimpl_id}"/>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
#
|
|
|
|
# Liste les noms de partitions
|
2023-02-20 21:04:29 +01:00
|
|
|
partitions = sco_groups.get_partitions_list(formsemestre.id)
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2023-02-10 22:04:09 +01:00
|
|
|
"""Afficher les groupes
|
2022-12-15 17:09:35 +01:00
|
|
|
de <select name="partition_id" onchange="document.f.submit();">"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2020-12-26 00:39:45 +01:00
|
|
|
been_selected = False
|
2020-09-26 16:19:37 +02:00
|
|
|
for partition in partitions:
|
2020-12-26 00:39:45 +01:00
|
|
|
if not partition_id and not been_selected:
|
|
|
|
selected = "selected"
|
|
|
|
been_selected = True
|
2020-09-26 16:19:37 +02:00
|
|
|
if partition["partition_id"] == partition_id:
|
|
|
|
selected = "selected"
|
|
|
|
else:
|
|
|
|
selected = ""
|
|
|
|
name = partition["partition_name"]
|
|
|
|
if name is None:
|
|
|
|
name = "Tous"
|
|
|
|
H.append(
|
2023-02-10 22:04:09 +01:00
|
|
|
f"""<option value="{partition['partition_id']}" {selected}>{name}</option>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append(
|
2023-02-20 21:04:29 +01:00
|
|
|
f"""</select>
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-02-20 21:04:29 +01:00
|
|
|
<a class="stdlink" href="{
|
|
|
|
url_for("notes.evaluation_listenotes", scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl.id)
|
|
|
|
}">Voir toutes les notes</a>
|
2020-09-26 16:19:37 +02:00
|
|
|
</span>
|
|
|
|
</form>
|
|
|
|
</p>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
|
|
|
|
# -------- Tableau des evaluations
|
|
|
|
top_table_links = ""
|
2022-04-28 07:06:01 +02:00
|
|
|
if can_edit_evals:
|
|
|
|
top_table_links = f"""<a class="stdlink" href="{
|
2023-02-20 21:04:29 +01:00
|
|
|
url_for("notes.evaluation_create", scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl.id)
|
2022-04-28 07:06:01 +02:00
|
|
|
}">Créer nouvelle évaluation</a>
|
2022-09-02 22:05:38 +02:00
|
|
|
"""
|
2022-12-15 17:09:35 +01:00
|
|
|
if nb_evaluations > 0:
|
2022-09-02 22:05:38 +02:00
|
|
|
top_table_links += f"""
|
2022-04-28 07:06:01 +02:00
|
|
|
<a class="stdlink" style="margin-left:2em;" href="{
|
2023-11-15 12:31:28 +01:00
|
|
|
url_for("notes.moduleimpl_evaluation_renumber",
|
2023-08-22 17:02:00 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl.id)
|
2024-07-19 16:32:56 +02:00
|
|
|
}" title="Ordonner les évaluations par date">Trier par date</a>
|
2022-04-28 07:06:01 +02:00
|
|
|
"""
|
2024-07-19 16:32:56 +02:00
|
|
|
bot_table_links = (
|
|
|
|
top_table_links
|
|
|
|
+ f"""
|
|
|
|
<a class="stdlink" style="margin-left:2em;" href="{
|
|
|
|
url_for("notes.moduleimpl_import_notes",
|
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl.id)
|
|
|
|
}" title="Charger toutles les notes via tableur">Importer les notes</a>
|
|
|
|
"""
|
|
|
|
)
|
2024-08-06 22:37:06 +02:00
|
|
|
else:
|
|
|
|
bot_table_links = top_table_links
|
2022-12-15 17:09:35 +01:00
|
|
|
if nb_evaluations > 0:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
|
|
|
'<div class="moduleimpl_evaluations_top_links">'
|
|
|
|
+ top_table_links
|
|
|
|
+ "</div>"
|
|
|
|
)
|
|
|
|
H.append("""<table class="moduleimpl_evaluations">""")
|
2022-12-15 17:09:35 +01:00
|
|
|
eval_index = nb_evaluations - 1
|
2021-12-19 11:08:03 +01:00
|
|
|
first_eval = True
|
2022-12-15 17:09:35 +01:00
|
|
|
for evaluation in evaluations:
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append(
|
|
|
|
_ligne_evaluation(
|
|
|
|
modimpl,
|
2022-12-15 17:09:35 +01:00
|
|
|
evaluation,
|
2022-10-01 18:55:32 +02:00
|
|
|
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,
|
2022-12-15 17:09:35 +01:00
|
|
|
nb_evals=nb_evaluations,
|
2022-10-02 18:43:18 +02:00
|
|
|
is_apc=nt.is_apc,
|
2024-05-29 12:12:31 +02:00
|
|
|
max_poids=max_poids_by_type.get(evaluation.evaluation_type, 10000.0),
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
eval_index -= 1
|
2022-10-01 18:55:32 +02:00
|
|
|
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:
|
2024-07-19 16:32:56 +02:00
|
|
|
H.append(
|
|
|
|
f"""<div class="moduleimpl_evaluations_table_bot">{bot_table_links}</div>"""
|
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
|
|
|
|
H.append(
|
|
|
|
f"""</td></tr>
|
|
|
|
</table>
|
|
|
|
|
2023-02-10 22:04:09 +01:00
|
|
|
<div class="list_etuds_attente">
|
|
|
|
{_html_modimpl_etuds_attente(nt, modimpl)}
|
|
|
|
</div>
|
|
|
|
|
2022-10-01 18:55:32 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- LEGENDE -->
|
|
|
|
<hr>
|
|
|
|
<h4>Légende</h4>
|
|
|
|
<ul>
|
2023-02-10 22:04:09 +01:00
|
|
|
<li>{scu.icontag("edit_img")} : modifie description de l'évaluation
|
2022-10-01 18:55:32 +02:00
|
|
|
(date, heure, coefficient, ...)
|
|
|
|
</li>
|
|
|
|
<li>{scu.icontag("notes_img")} : saisie des notes</li>
|
2023-02-10 22:04:09 +01:00
|
|
|
<li>{scu.icontag("delete_img")} : indique qu'il n'y a aucune note
|
2022-10-01 18:55:32 +02:00
|
|
|
entrée (cliquer pour supprimer cette évaluation)
|
|
|
|
</li>
|
2023-02-10 22:04:09 +01:00
|
|
|
<li>{scu.icontag("status_orange_img")} : indique qu'il manque
|
2022-10-01 18:55:32 +02:00
|
|
|
quelques notes dans cette évaluation
|
|
|
|
</li>
|
2023-02-10 22:04:09 +01:00
|
|
|
<li>{scu.icontag("status_green_img")} : toutes les notes sont
|
2022-10-01 18:55:32 +02:00
|
|
|
entrées (cliquer pour les afficher)
|
|
|
|
</li>
|
2023-02-10 22:04:09 +01:00
|
|
|
<li>{scu.icontag("status_visible_img")} : indique que cette évaluation
|
2022-10-01 18:55:32 +02:00
|
|
|
sera mentionnée dans les bulletins au format "intermédiaire"
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
2023-02-10 22:04:09 +01:00
|
|
|
<p>Rappel : seules les notes des évaluations complètement saisies
|
2022-10-01 18:55:32 +02:00
|
|
|
(affichées en vert) apparaissent dans les bulletins.
|
|
|
|
</p>
|
|
|
|
"""
|
|
|
|
)
|
2024-07-19 18:03:24 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
content="".join(H),
|
|
|
|
title=f"{mod_type_name} {module.code} {module.titre}",
|
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
def _ligne_evaluation(
|
|
|
|
modimpl: ModuleImpl,
|
2022-12-15 17:09:35 +01:00
|
|
|
evaluation: Evaluation,
|
2022-10-01 18:55:32 +02:00
|
|
|
first_eval: bool = True,
|
2022-12-16 01:27:52 +01:00
|
|
|
partition_id: int = None,
|
2022-10-01 18:55:32 +02:00
|
|
|
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,
|
2022-12-16 01:27:52 +01:00
|
|
|
is_apc: bool = False,
|
|
|
|
max_poids: float = 0.0,
|
2022-10-01 18:55:32 +02:00
|
|
|
) -> str:
|
|
|
|
"""Ligne <tr> décrivant une évaluation dans le tableau de bord moduleimpl."""
|
|
|
|
H = []
|
2023-07-11 06:57:38 +02:00
|
|
|
# evaluation: Evaluation = db.session.get(Evaluation, eval_dict["evaluation_id"])
|
2022-10-01 18:55:32 +02:00
|
|
|
etat = sco_evaluations.do_evaluation_etat(
|
|
|
|
evaluation.id,
|
|
|
|
partition_id=partition_id,
|
|
|
|
select_first_partition=True,
|
|
|
|
)
|
2024-02-24 16:49:41 +01:00
|
|
|
if evaluation.evaluation_type == Evaluation.EVALUATION_RATTRAPAGE:
|
2022-10-01 18:55:32 +02:00
|
|
|
tr_class = "mievr mievr_rattr"
|
2024-02-24 16:49:41 +01:00
|
|
|
elif evaluation.evaluation_type == Evaluation.EVALUATION_SESSION2:
|
|
|
|
tr_class = "mievr mievr_session2"
|
|
|
|
elif evaluation.evaluation_type == Evaluation.EVALUATION_BONUS:
|
|
|
|
tr_class = "mievr mievr_bonus"
|
2022-10-01 18:55:32 +02:00
|
|
|
else:
|
|
|
|
tr_class = "mievr"
|
2024-02-24 16:49:41 +01:00
|
|
|
|
2023-10-12 22:53:26 +02:00
|
|
|
if not evaluation.visibulletin:
|
|
|
|
tr_class += " non_visible_inter"
|
2022-10-01 18:55:32 +02:00
|
|
|
tr_class_1 = "mievr"
|
2024-02-25 16:58:59 +01:00
|
|
|
if evaluation.is_blocked():
|
|
|
|
tr_class += " evaluation_blocked"
|
|
|
|
tr_class_1 += " evaluation_blocked"
|
|
|
|
|
2022-10-01 18:55:32 +02:00
|
|
|
if not first_eval:
|
|
|
|
H.append("""<tr><td colspan="8"> </td></tr>""")
|
|
|
|
tr_class_1 += " mievr_spaced"
|
2023-01-26 14:49:04 +01:00
|
|
|
H.append(
|
|
|
|
f"""<tr class="{tr_class_1} mievr_tit"><td class="mievr_tit" colspan="8">"""
|
|
|
|
)
|
2022-10-02 18:43:18 +02:00
|
|
|
coef = evaluation.coefficient
|
|
|
|
if is_apc:
|
2022-10-05 10:31:25 +02:00
|
|
|
if not evaluation.get_ue_poids_dict():
|
|
|
|
# Au cas où les poids par défaut n'existent pas encore:
|
|
|
|
if evaluation.set_default_poids():
|
|
|
|
db.session.commit()
|
2022-10-02 18:43:18 +02:00
|
|
|
coef *= sum(evaluation.get_ue_poids_dict().values())
|
2022-10-15 10:27:00 +02:00
|
|
|
|
|
|
|
if modimpl.module.ue.type != UE_SPORT:
|
|
|
|
# Avertissement si coefs x poids nuls
|
|
|
|
if coef < scu.NOTES_PRECISION:
|
2023-07-31 20:37:58 +02:00
|
|
|
if modimpl.module.module_type == scu.ModuleType.MALUS:
|
|
|
|
H.append("""<span class="eval_warning_coef">malus</span>""")
|
|
|
|
else:
|
|
|
|
H.append("""<span class="eval_warning_coef">coef. nul !</span>""")
|
2022-10-15 10:27:00 +02:00
|
|
|
elif is_apc:
|
2022-12-16 01:27:52 +01:00
|
|
|
# visualisation des poids (Hinton map)
|
|
|
|
H.append(_evaluation_poids_html(evaluation, max_poids))
|
2022-12-15 17:09:35 +01:00
|
|
|
H.append("""<div class="evaluation_titre">""")
|
2023-08-25 17:58:57 +02:00
|
|
|
if evaluation.date_debut:
|
|
|
|
H.append(evaluation.descr_date())
|
2022-10-01 18:55:32 +02:00
|
|
|
else:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-10-01 18:55:32 +02:00
|
|
|
f"""<a href="{url_for("notes.evaluation_edit",
|
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
|
|
}" class="mievr_evalnodate">Évaluation sans date</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-25 16:58:59 +01:00
|
|
|
H.append(f" <em>{evaluation.description}</em>")
|
2024-02-24 16:49:41 +01:00
|
|
|
if evaluation.evaluation_type == Evaluation.EVALUATION_RATTRAPAGE:
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append(
|
|
|
|
"""<span class="mievr_rattr" title="remplace si meilleure note">rattrapage</span>"""
|
|
|
|
)
|
2024-02-24 16:49:41 +01:00
|
|
|
elif evaluation.evaluation_type == Evaluation.EVALUATION_SESSION2:
|
|
|
|
H.append(
|
|
|
|
"""<span class="mievr_session2" title="remplace autres notes">session 2</span>"""
|
|
|
|
)
|
|
|
|
elif evaluation.evaluation_type == Evaluation.EVALUATION_BONUS:
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append(
|
2024-02-24 16:49:41 +01:00
|
|
|
"""<span class="mievr_bonus" title="s'ajoute aux moyennes de ce module">bonus</span>"""
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
|
|
|
#
|
|
|
|
if etat["last_modif"]:
|
|
|
|
H.append(
|
|
|
|
f"""<span class="mievr_lastmodif">(dernière modif le {
|
2024-08-24 08:06:46 +02:00
|
|
|
etat["last_modif"].strftime(scu.DATEATIME_FMT)})</span>"""
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
|
|
|
#
|
2022-10-02 18:43:18 +02:00
|
|
|
H.append(
|
2023-01-26 14:49:04 +01:00
|
|
|
f"""
|
|
|
|
</td>
|
|
|
|
<td class="evaluation_order">
|
2022-10-02 18:43:18 +02:00
|
|
|
<span class="evalindex" title="Indice dans les vecteurs (formules)">{
|
|
|
|
eval_index:2}</span>
|
|
|
|
<span class="eval_arrows_chld">
|
|
|
|
"""
|
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
# Fleches:
|
|
|
|
if eval_index != (nb_evals - 1) and can_edit_evals:
|
|
|
|
H.append(
|
2023-01-27 14:20:52 +01:00
|
|
|
f"""<a href="{url_for("notes.moduleimpl_evaluation_move",
|
2022-10-02 18:43:18 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id, after=0)
|
|
|
|
}" class="aud">{arrow_up}</a>"""
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
H.append(arrow_none)
|
|
|
|
if (eval_index > 0) and can_edit_evals:
|
|
|
|
H.append(
|
2023-01-27 14:20:52 +01:00
|
|
|
f"""<a href="{url_for("notes.moduleimpl_evaluation_move",
|
2022-10-02 18:43:18 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id, after=1)
|
|
|
|
}" class="aud">{arrow_down}</a>"""
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
H.append(arrow_none)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-02-25 16:58:59 +01:00
|
|
|
if evaluation.is_blocked():
|
|
|
|
etat_txt = f"""évaluation bloquée {
|
2024-04-02 23:37:23 +02:00
|
|
|
"jusqu'au " + evaluation.blocked_until.strftime(scu.DATE_FMT)
|
2024-02-25 16:58:59 +01:00
|
|
|
if evaluation.blocked_until < Evaluation.BLOCKED_FOREVER
|
|
|
|
else "" }
|
|
|
|
"""
|
|
|
|
etat_descr = """prise en compte bloquée"""
|
|
|
|
elif etat["evalcomplete"]:
|
|
|
|
etat_txt = f"""Moyenne (prise en compte{
|
2023-10-12 22:53:26 +02:00
|
|
|
""
|
|
|
|
if evaluation.visibulletin
|
|
|
|
else ", cachée en intermédiaire"})
|
|
|
|
"""
|
|
|
|
etat_descr = f"""notes utilisées dans les moyennes{
|
|
|
|
", évaluation cachée sur les bulletins en version intermédiaire et sur la passerelle"
|
|
|
|
}"""
|
2023-01-09 00:09:18 +01:00
|
|
|
elif etat["evalattente"] and not evaluation.publish_incomplete:
|
2024-02-25 16:58:59 +01:00
|
|
|
etat_txt = "Moyenne (prise en compte, mais <b>notes en attente</b>)"
|
2023-01-08 22:53:33 +01:00
|
|
|
etat_descr = "il y a des notes en attente"
|
2022-12-15 17:09:35 +01:00
|
|
|
elif evaluation.publish_incomplete:
|
2022-10-01 18:55:32 +02:00
|
|
|
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:
|
2024-02-25 16:58:59 +01:00
|
|
|
etat_txt = "Moyenne (<b>non</b> prise en compte)"
|
2022-10-01 18:55:32 +02:00
|
|
|
etat_descr = "il manque des notes"
|
|
|
|
else:
|
|
|
|
etat_txt = ""
|
2024-02-25 16:58:59 +01:00
|
|
|
if etat_txt:
|
|
|
|
if can_edit_evals:
|
|
|
|
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>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append(
|
2023-01-26 14:49:04 +01:00
|
|
|
f"""</span></span></td>
|
|
|
|
</tr>
|
2024-02-25 16:58:59 +01:00
|
|
|
<tr class="{tr_class} mievr_in">
|
2023-01-26 14:49:04 +01:00
|
|
|
<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>
|
2024-04-02 23:37:23 +02:00
|
|
|
<th class="moduleimpl_evaluations moduleimpl_evaluation_moy"
|
|
|
|
colspan="2"><span>{etat_txt}</span></th>
|
2023-01-26 14:49:04 +01:00
|
|
|
</tr>
|
2024-02-25 16:58:59 +01:00
|
|
|
<tr class="{tr_class} mievr_in">
|
2023-01-26 14:49:04 +01:00
|
|
|
<td class="mievr">"""
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
|
|
|
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(
|
2024-08-25 07:23:36 +02:00
|
|
|
f"""<a class="smallbutton" href="{url_for('notes.form_saisie_notes',
|
2022-10-01 18:55:32 +02:00
|
|
|
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:
|
2022-04-28 07:06:01 +02:00
|
|
|
if can_edit_evals:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-10-01 18:55:32 +02:00
|
|
|
f"""<a class="smallbutton" href="{url_for('notes.evaluation_delete',
|
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
|
|
}">"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
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"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-10-01 18:55:32 +02:00
|
|
|
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>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
H.append(
|
2022-10-01 18:55:32 +02:00
|
|
|
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>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
#
|
2022-12-15 17:09:35 +01:00
|
|
|
if evaluation.visibulletin:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-10-01 18:55:32 +02:00
|
|
|
scu.icontag(
|
|
|
|
"status_visible_img", title="visible dans bulletins intermédiaires"
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
else:
|
|
|
|
H.append(" ")
|
|
|
|
H.append('</td><td class="mievr_menu">')
|
|
|
|
if can_edit_notes:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-10-01 18:55:32 +02:00
|
|
|
moduleimpl_evaluation_menu(
|
2023-08-30 08:53:36 +02:00
|
|
|
evaluation,
|
2022-10-01 18:55:32 +02:00
|
|
|
nbnotes=etat["nb_notes"],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
#
|
|
|
|
H.append(
|
2022-10-02 18:43:18 +02:00
|
|
|
f"""</td>
|
2022-12-15 17:09:35 +01:00
|
|
|
<td class="mievr_dur">{evaluation.descr_duree()}</td>
|
|
|
|
<td class="rightcell mievr_coef">{evaluation.coefficient:g}</td>
|
2022-10-02 18:43:18 +02:00
|
|
|
"""
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
|
|
|
H.append(
|
2022-10-02 18:43:18 +02:00
|
|
|
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>
|
2023-01-26 14:49:04 +01:00
|
|
|
<td class="rightcell" colspan="2">"""
|
2022-10-01 18:55:32 +02:00
|
|
|
% etat
|
|
|
|
)
|
2024-06-27 07:23:27 +02:00
|
|
|
if etat["nb_notes"]:
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append(
|
2023-06-09 19:39:39 +02:00
|
|
|
f"""<b>{etat["moy"]} / 20</b>
|
2022-10-02 18:43:18 +02:00
|
|
|
(<a class="stdlink" href="{
|
|
|
|
url_for('notes.evaluation_listenotes',
|
2022-10-01 18:55:32 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
|
|
}">afficher</a>)"""
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
H.append(
|
2024-08-25 07:23:36 +02:00
|
|
|
f"""<a class="redlink" href="{url_for('notes.form_saisie_notes',
|
2022-10-01 18:55:32 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
|
|
|
|
}">saisir notes</a>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append("""</td></tr>""")
|
|
|
|
#
|
|
|
|
if etat["nb_notes"] == 0:
|
|
|
|
H.append(f"""<tr class="{tr_class}"><td></td>""")
|
2024-05-29 11:55:28 +02:00
|
|
|
# if modimpl.module.is_apc():
|
|
|
|
# H.append(
|
|
|
|
# f"""<td colspan="8" class="eval_poids">{
|
|
|
|
# evaluation.get_ue_poids_str()}</td>"""
|
|
|
|
# )
|
|
|
|
# else:
|
|
|
|
# H.append('<td colspan="8"></td>')
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append("""</tr>""")
|
|
|
|
else: # il y a deja des notes saisies
|
|
|
|
gr_moyennes = etat["gr_moyennes"]
|
2024-05-29 11:55:28 +02:00
|
|
|
# first_group = True
|
2022-10-01 18:55:32 +02:00
|
|
|
for gr_moyenne in gr_moyennes:
|
|
|
|
H.append(f"""<tr class="{tr_class}"><td> </td>""")
|
2024-05-29 11:55:28 +02:00
|
|
|
# if first_group and modimpl.module.is_apc():
|
|
|
|
# H.append(
|
|
|
|
# f"""<td class="eval_poids" colspan="4">{
|
|
|
|
# evaluation.get_ue_poids_str()}</td>"""
|
|
|
|
# )
|
|
|
|
# else:
|
|
|
|
H.append("""<td colspan="4"></td>""")
|
|
|
|
# first_group = False
|
2022-10-01 18:55:32 +02:00
|
|
|
if gr_moyenne["group_name"] is None:
|
|
|
|
name = "Tous" # tous
|
|
|
|
else:
|
|
|
|
name = f"""Groupe {gr_moyenne["group_name"]}"""
|
2023-01-26 14:49:04 +01:00
|
|
|
H.append(
|
|
|
|
f"""<td colspan="2" class="mievr_grtit">{name} </td>
|
|
|
|
<td colspan="2">"""
|
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
if gr_moyenne["gr_nb_notes"] > 0:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-06-25 18:10:01 +02:00
|
|
|
f"""{gr_moyenne["gr_moy"]} (<a class="stdlink" href="{
|
2022-10-01 18:55:32 +02:00
|
|
|
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>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
if gr_moyenne["gr_nb_att"] > 0:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-10-02 18:43:18 +02:00
|
|
|
f""", <span class="redboldtext">{
|
|
|
|
gr_moyenne["gr_nb_att"]} en attente</span>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
H.append(""")""")
|
|
|
|
if gr_moyenne["group_id"] in etat["gr_incomplets"]:
|
|
|
|
H.append("""[<font color="red">""")
|
2022-04-28 07:06:01 +02:00
|
|
|
if can_edit_notes:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-08-25 07:23:36 +02:00
|
|
|
f"""<a class="redlink" href="{url_for('notes.form_saisie_notes',
|
2022-10-01 18:55:32 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id,
|
|
|
|
**{'group_ids:list': gr_moyenne["group_id"]})
|
2024-06-27 07:23:27 +02:00
|
|
|
}">incomplet : terminer saisie</a></font>]"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-10-01 18:55:32 +02:00
|
|
|
else:
|
|
|
|
H.append("""incomplet</font>]""")
|
|
|
|
else:
|
|
|
|
H.append("""<span class="redboldtext"> """)
|
|
|
|
if can_edit_notes:
|
|
|
|
H.append(
|
2024-08-25 07:23:36 +02:00
|
|
|
f"""<a class="redlink" href="{url_for('notes.form_saisie_notes',
|
2022-10-01 18:55:32 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id,
|
2024-08-25 07:23:36 +02:00
|
|
|
**{'group_ids': gr_moyenne["group_id"]})
|
2022-10-03 11:07:43 +02:00
|
|
|
}">"""
|
2022-10-01 18:55:32 +02:00
|
|
|
)
|
|
|
|
H.append("pas de notes")
|
|
|
|
if can_edit_notes:
|
|
|
|
H.append("""</a>""")
|
|
|
|
H.append("</span>")
|
|
|
|
H.append("""</td></tr>""")
|
|
|
|
return "\n".join(H)
|
2022-10-02 18:43:18 +02:00
|
|
|
|
|
|
|
|
2022-12-16 01:27:52 +01:00
|
|
|
def _evaluation_poids_html(evaluation: Evaluation, max_poids: float = 0.0) -> str:
|
|
|
|
"""graphe html (Hinton map) montrant les poids x coef de l'évaluation"""
|
2022-10-03 09:04:04 +02:00
|
|
|
ue_poids = evaluation.get_ue_poids_dict(sort=True) # { ue_id : poids }
|
2022-10-02 18:43:18 +02:00
|
|
|
if not ue_poids:
|
2022-12-17 03:33:04 +01:00
|
|
|
return ""
|
2024-05-29 11:55:28 +02:00
|
|
|
values = [poids * (evaluation.coefficient) for poids in ue_poids.values()]
|
|
|
|
colors = [db.session.get(UniteEns, ue_id).color for ue_id in ue_poids]
|
|
|
|
return _html_hinton_map(
|
|
|
|
classes=("evaluation_poids",),
|
|
|
|
colors=colors,
|
|
|
|
max_val=max_poids,
|
|
|
|
title=f"Poids de l'évaluation vers les UEs: {evaluation.get_ue_poids_str()}",
|
|
|
|
values=values,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def _html_hinton_map(
|
|
|
|
classes=(),
|
|
|
|
colors=(),
|
|
|
|
max_val: float | None = None,
|
|
|
|
size=12,
|
|
|
|
title: str = "",
|
|
|
|
values=(),
|
|
|
|
) -> str:
|
|
|
|
"""Représente une liste de nombres sous forme de carrés"""
|
|
|
|
if max_val is None:
|
|
|
|
max_val = max(values)
|
|
|
|
if max_val < scu.NOTES_PRECISION:
|
2022-12-17 03:33:04 +01:00
|
|
|
return ""
|
2024-05-29 11:55:28 +02:00
|
|
|
return (
|
|
|
|
f"""<div class="hinton_map {" ".join(classes)}"
|
|
|
|
style="--size:{size}px;"
|
|
|
|
title="{title}"
|
|
|
|
data-tooltip>"""
|
2022-10-02 18:43:18 +02:00
|
|
|
+ "\n".join(
|
|
|
|
[
|
2024-05-29 11:55:28 +02:00
|
|
|
f"""<div>
|
|
|
|
<div style="--boxsize:{size*math.sqrt(value/max_val)}px;
|
|
|
|
{'background-color: ' + color + ';' if color else ''}
|
2022-10-03 11:07:43 +02:00
|
|
|
"></div>
|
|
|
|
</div>"""
|
2024-05-29 11:55:28 +02:00
|
|
|
for value, color in zip(values, colors)
|
2022-10-02 18:43:18 +02:00
|
|
|
]
|
|
|
|
)
|
|
|
|
+ "</div>"
|
|
|
|
)
|
2023-02-10 22:04:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
def _html_modimpl_etuds_attente(res: ResultatsSemestre, modimpl: ModuleImpl) -> str:
|
|
|
|
"""Affiche la liste des étudiants ayant au moins une note en attente dans ce modimpl"""
|
|
|
|
m_res = res.modimpls_results.get(modimpl.id)
|
|
|
|
if m_res:
|
|
|
|
if not m_res.etudids_attente:
|
|
|
|
return "<div><em>Aucun étudiant n'a de notes en attente.</em></div>"
|
|
|
|
elif len(m_res.etudids_attente) < 10:
|
|
|
|
return f"""
|
|
|
|
<h4>Étudiants avec une note en attente :</h4>
|
|
|
|
{list_etuds.html_table_etuds(m_res.etudids_attente)}
|
|
|
|
"""
|
|
|
|
else:
|
|
|
|
return f"""<div class="warning"><em>{
|
|
|
|
len(m_res.etudids_attente)
|
|
|
|
} étudiants ont des notes en attente.</em></div>"""
|
|
|
|
|
|
|
|
return ""
|