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-22 15:41:39 +01:00
|
|
|
"""Tableau de bord semestre"""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2022-04-19 23:52:52 +02:00
|
|
|
import datetime
|
2022-10-05 23:48:54 +02:00
|
|
|
|
2021-06-17 00:08:37 +02:00
|
|
|
from flask import current_app
|
2021-07-09 10:26:31 +02:00
|
|
|
from flask import g
|
2021-07-29 16:31:15 +02:00
|
|
|
from flask import request
|
2022-10-05 23:48:54 +02:00
|
|
|
from flask import flash, redirect, render_template, url_for
|
2021-07-29 16:31:15 +02:00
|
|
|
from flask_login import current_user
|
2022-10-06 00:19:54 +02:00
|
|
|
|
2023-07-11 06:57:38 +02:00
|
|
|
from app import db, log
|
2023-04-03 17:46:31 +02:00
|
|
|
from app.but.cursus_but import formsemestre_warning_apc_setup
|
2022-01-08 18:06:00 +01:00
|
|
|
from app.comp import res_sem
|
2022-10-05 23:48:54 +02:00
|
|
|
from app.comp.res_common import ResultatsSemestre
|
2022-03-27 22:25:00 +02:00
|
|
|
from app.comp.res_compat import NotesTableCompat
|
2023-07-11 06:57:38 +02:00
|
|
|
from app.models import (
|
|
|
|
Evaluation,
|
|
|
|
Formation,
|
|
|
|
FormSemestre,
|
|
|
|
Identite,
|
|
|
|
Module,
|
|
|
|
ModuleImpl,
|
|
|
|
NotesNotes,
|
|
|
|
)
|
2023-08-27 14:27:50 +02:00
|
|
|
from app.scodoc.codes_cursus import UE_SPORT
|
2022-09-18 16:53:00 +02:00
|
|
|
from app.scodoc.sco_exceptions import (
|
|
|
|
ScoValueError,
|
|
|
|
ScoInvalidIdType,
|
|
|
|
)
|
2024-01-20 17:37:24 +01:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
|
|
|
import app.scodoc.sco_utils as scu
|
|
|
|
from app.scodoc.sco_utils import ModuleType
|
|
|
|
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import html_sco_header
|
|
|
|
from app.scodoc import htmlutils
|
2023-12-23 13:53:02 +01:00
|
|
|
from app.scodoc import sco_archives_formsemestre
|
2024-07-09 15:23:36 +02:00
|
|
|
from app.scodoc import sco_assiduites as scass
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import sco_bulletins
|
2023-02-12 13:36:47 +01:00
|
|
|
from app.scodoc import codes_cursus
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import sco_compute_moy
|
|
|
|
from app.scodoc import sco_evaluations
|
|
|
|
from app.scodoc import sco_formations
|
|
|
|
from app.scodoc import sco_formsemestre
|
|
|
|
from app.scodoc import sco_formsemestre_inscriptions
|
|
|
|
from app.scodoc import sco_groups
|
|
|
|
from app.scodoc import sco_preferences
|
2021-07-03 23:35:32 +02:00
|
|
|
from app.scodoc import sco_users
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.gen_tables import GenTable
|
2024-01-21 18:07:56 +01:00
|
|
|
from app.scodoc.html_sidebar import retreive_formsemestre_from_request
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.sco_formsemestre_custommenu import formsemestre_custommenu_html
|
2021-12-10 15:27:52 +01:00
|
|
|
import sco_version
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2024-01-27 13:13:44 +01:00
|
|
|
def _build_menu_stats(formsemestre: FormSemestre):
|
2021-09-13 19:36:53 +02:00
|
|
|
"Définition du menu 'Statistiques'"
|
2024-01-27 13:13:44 +01:00
|
|
|
formsemestre_id = formsemestre.id
|
2020-09-26 16:19:37 +02:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
"title": "Statistiques...",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_report_counts",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Suivi de cohortes",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_suivi_cohorte",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
},
|
|
|
|
{
|
2023-02-12 13:36:47 +01:00
|
|
|
"title": "Graphe des cursus",
|
|
|
|
"endpoint": "notes.formsemestre_graph_cursus",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2021-07-25 16:42:47 +02:00
|
|
|
"enabled": True,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
2023-02-12 13:36:47 +01:00
|
|
|
"title": "Codes des cursus",
|
|
|
|
"endpoint": "notes.formsemestre_suivi_cursus",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Lycées d'origine",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_etuds_lycees",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2024-01-20 17:37:24 +01:00
|
|
|
"enabled": current_user.has_permission(Permission.ViewEtudData),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": 'Table "poursuite"',
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_poursuite_report",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
},
|
|
|
|
{
|
2022-01-26 23:51:46 +01:00
|
|
|
"title": "Documents Avis Poursuite Etudes (xp)",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.pe_view_sem_recap",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2024-01-27 13:13:44 +01:00
|
|
|
"enabled": formsemestre.formation.is_apc(),
|
|
|
|
# current_app.config["TESTING"] or current_app.config["DEBUG"],
|
2021-06-14 18:08:52 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": 'Table "débouchés"',
|
|
|
|
"endpoint": "notes.report_debouche_date",
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Estimation du coût de la formation",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "notes.formsemestre_estim_cost",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
},
|
2022-09-26 22:54:49 +02:00
|
|
|
{
|
|
|
|
"title": "Indicateurs de suivi annuel BUT",
|
|
|
|
"endpoint": "notes.formsemestre_but_indicateurs",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
|
|
|
"enabled": True,
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2024-04-07 19:52:22 +02:00
|
|
|
def formsemestre_status_menubar(formsemestre: FormSemestre | None) -> str:
|
2020-09-26 16:19:37 +02:00
|
|
|
"""HTML to render menubar"""
|
2024-04-07 19:52:22 +02:00
|
|
|
if formsemestre is None:
|
|
|
|
return ""
|
2022-08-30 20:31:05 +02:00
|
|
|
formsemestre_id = formsemestre.id
|
|
|
|
if formsemestre.etat:
|
2020-09-26 16:19:37 +02:00
|
|
|
change_lock_msg = "Verrouiller"
|
|
|
|
else:
|
|
|
|
change_lock_msg = "Déverrouiller"
|
|
|
|
|
2022-08-30 20:31:05 +02:00
|
|
|
formation = formsemestre.formation
|
|
|
|
|
|
|
|
# L'utilisateur est-il resp. du semestre ?
|
|
|
|
is_responsable = current_user.id in (u.id for u in formsemestre.responsables)
|
|
|
|
# A le droit de changer le semestre (déverrouiller, préférences bul., ...):
|
2023-09-29 21:17:31 +02:00
|
|
|
has_perm_change_sem = current_user.has_permission(Permission.EditFormSemestre) or (
|
2022-08-30 20:31:05 +02:00
|
|
|
formsemestre.resp_can_edit and is_responsable
|
|
|
|
)
|
|
|
|
# Peut modifier le semestre (si n'est pas verrouillé):
|
|
|
|
can_modify_sem = has_perm_change_sem and formsemestre.etat
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_semestre = [
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Tableau de bord",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_status",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
"helpmsg": "Tableau de bord du semestre",
|
|
|
|
},
|
2023-09-18 16:27:07 +02:00
|
|
|
# {
|
2023-09-21 08:46:21 +02:00
|
|
|
# "title": "Assiduité du semestre",
|
2023-09-18 16:27:07 +02:00
|
|
|
# "endpoint": "assiduites.liste_assiduites_formsemestre",
|
|
|
|
# "args": {"formsemestre_id": formsemestre_id},
|
|
|
|
# "enabled": True,
|
2023-09-21 08:46:21 +02:00
|
|
|
# "helpmsg": "Tableau de l'assiduité et des justificatifs du semestre",
|
2023-09-18 16:27:07 +02:00
|
|
|
# },
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
2022-08-30 20:31:05 +02:00
|
|
|
"title": f"Voir la formation {formation.acronyme} (v{formation.version})",
|
2021-10-17 23:19:26 +02:00
|
|
|
"endpoint": "notes.ue_table",
|
2022-05-29 17:34:03 +02:00
|
|
|
"args": {
|
2022-08-30 20:31:05 +02:00
|
|
|
"formation_id": formation.id,
|
|
|
|
"semestre_idx": formsemestre.semestre_id,
|
2022-05-29 17:34:03 +02:00
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
"helpmsg": "Tableau de bord du semestre",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Modifier le semestre",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "notes.formsemestre_editwithmodules",
|
|
|
|
"args": {
|
|
|
|
"formsemestre_id": formsemestre_id,
|
|
|
|
},
|
2022-08-30 20:31:05 +02:00
|
|
|
"enabled": can_modify_sem,
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "Modifie le contenu du semestre (modules)",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Préférences du semestre",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "scolar.formsemestre_edit_preferences",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2022-08-30 20:31:05 +02:00
|
|
|
"enabled": can_modify_sem,
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "Préférences du semestre",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Réglages bulletins",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_edit_options",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2022-08-30 20:31:05 +02:00
|
|
|
"enabled": has_perm_change_sem,
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "Change les options",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": change_lock_msg,
|
2023-02-21 21:34:38 +01:00
|
|
|
"endpoint": "notes.formsemestre_flip_lock",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2022-08-30 20:31:05 +02:00
|
|
|
"enabled": has_perm_change_sem,
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Description du semestre",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_description",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
"helpmsg": "",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Lister tous les enseignants",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_enseignants_list",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
"helpmsg": "",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Cloner ce semestre",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_clone",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.EditFormSemestre),
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Associer à une nouvelle version du programme",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_associate_new_version",
|
2023-02-23 21:19:57 +01:00
|
|
|
"args": {
|
|
|
|
"formsemestre_id": formsemestre_id,
|
|
|
|
"formation_id": formsemestre.formation_id,
|
|
|
|
},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.EditFormation)
|
2022-08-30 20:31:05 +02:00
|
|
|
and formsemestre.etat,
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Supprimer ce semestre",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_delete",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.EditFormSemestre),
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "",
|
|
|
|
},
|
2023-11-11 18:13:18 +01:00
|
|
|
{
|
|
|
|
"title": "Expérimental: emploi du temps",
|
|
|
|
"endpoint": "notes.formsemestre_edt",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
|
|
|
"enabled": True,
|
|
|
|
"helpmsg": "",
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
|
|
|
# debug :
|
2023-07-10 13:58:16 +02:00
|
|
|
if current_app.config["DEBUG"]:
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_semestre.append(
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
2021-07-07 10:01:36 +02:00
|
|
|
"title": "Vérifier l'intégrité",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.check_sem_integrity",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_inscriptions = [
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
2024-02-13 13:55:16 +01:00
|
|
|
"title": (
|
|
|
|
"Gérer les inscriptions aux UE et modules"
|
|
|
|
if formsemestre.formation.is_apc()
|
|
|
|
else "Gérer les inscriptions aux modules"
|
|
|
|
),
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.moduleimpl_inscriptions_stats",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
]
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_inscriptions += [
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Passage des étudiants depuis d'autres semestres",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_inscr_passage",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.EtudInscrit)
|
2022-08-30 20:31:05 +02:00
|
|
|
and formsemestre.etat,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Synchroniser avec étape Apogée",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_synchro_etuds",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoView)
|
2021-07-28 17:03:54 +02:00
|
|
|
and sco_preferences.get_preference("portal_url")
|
2022-08-30 20:31:05 +02:00
|
|
|
and formsemestre.etat,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Inscrire un étudiant",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_inscription_with_modules_etud",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.EtudInscrit)
|
2022-08-30 20:31:05 +02:00
|
|
|
and formsemestre.etat,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Importer des étudiants dans ce semestre (table Excel)",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "scolar.form_students_import_excel",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.EtudInscrit)
|
2022-08-30 20:31:05 +02:00
|
|
|
and formsemestre.etat,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Import/export des données admission",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "scolar.form_students_import_infos_admissions",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoView),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Resynchroniser données identité",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "scolar.formsemestre_import_etud_admission",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-29 21:17:31 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.EtudChangeAdr)
|
2021-07-28 17:03:54 +02:00
|
|
|
and sco_preferences.get_preference("portal_url"),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Exporter table des étudiants",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "scolar.groups_view",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {
|
2023-09-21 10:20:19 +02:00
|
|
|
"fmt": "allxls",
|
2021-06-14 18:08:52 +02:00
|
|
|
"group_ids": sco_groups.get_default_group(
|
2021-07-29 16:31:15 +02:00
|
|
|
formsemestre_id, fix_if_missing=True
|
2021-06-14 18:08:52 +02:00
|
|
|
),
|
|
|
|
},
|
2024-01-20 17:37:24 +01:00
|
|
|
"enabled": current_user.has_permission(Permission.ViewEtudData),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Vérifier inscriptions multiples",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_inscrits_ailleurs",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2023-09-02 22:19:35 +02:00
|
|
|
can_change_groups = formsemestre.can_change_groups()
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_groupes = [
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Listes, photos, feuilles...",
|
2021-06-19 23:21:37 +02:00
|
|
|
"endpoint": "scolar.groups_view",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
"helpmsg": "Accès aux listes des groupes d'étudiants",
|
|
|
|
},
|
|
|
|
{
|
2023-02-16 14:12:59 +01:00
|
|
|
"title": "Modifier groupes et partitions",
|
|
|
|
"endpoint": "scolar.partition_editor",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-02 22:19:35 +02:00
|
|
|
"enabled": can_change_groups,
|
2023-02-16 14:12:59 +01:00
|
|
|
"helpmsg": "Editeur de partitions",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Ancienne page édition partitions",
|
2022-05-22 05:01:25 +02:00
|
|
|
"endpoint": "scolar.edit_partition_form",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-09-02 22:19:35 +02:00
|
|
|
"enabled": can_change_groups,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
# 1 item / partition:
|
2021-08-19 10:28:35 +02:00
|
|
|
partitions = sco_groups.get_partitions_list(formsemestre_id, with_default=False)
|
2020-09-26 16:19:37 +02:00
|
|
|
submenu = []
|
2023-09-02 22:19:35 +02:00
|
|
|
enabled = can_change_groups and partitions
|
2020-09-26 16:19:37 +02:00
|
|
|
for partition in partitions:
|
|
|
|
submenu.append(
|
|
|
|
{
|
2022-08-30 20:31:05 +02:00
|
|
|
"title": str(partition["partition_name"]),
|
2021-10-04 22:05:05 +02:00
|
|
|
"endpoint": "scolar.affect_groups",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {"partition_id": partition["partition_id"]},
|
2022-08-30 20:31:05 +02:00
|
|
|
"enabled": enabled,
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
)
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_groupes.append(
|
2022-07-22 17:37:01 +02:00
|
|
|
{
|
2023-02-16 14:12:59 +01:00
|
|
|
"title": "Ancienne page édition groupes",
|
|
|
|
"submenu": submenu,
|
|
|
|
"enabled": enabled,
|
|
|
|
}
|
2022-07-22 17:37:01 +02:00
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_notes = [
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Tableau des moyennes (et liens bulletins)",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_recapcomplet",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2022-04-10 17:38:59 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "État des évaluations",
|
|
|
|
"endpoint": "notes.evaluations_recap",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Classeur PDF des bulletins",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_bulletins_pdf_choice",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "PDF regroupant tous les bulletins",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Envoyer à chaque étudiant son bulletin par e-mail",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_bulletins_mailetuds_choice",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2021-08-20 10:51:42 +02:00
|
|
|
"enabled": sco_bulletins.can_send_bulletin_by_mail(formsemestre_id),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Calendrier des évaluations",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_evaluations_cal",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Lister toutes les saisies de notes",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_list_saisies_notes",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
]
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_jury = [
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"title": "Voir les décisions du jury",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_pvjury",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Saisie des décisions du jury",
|
2023-02-12 01:13:43 +01:00
|
|
|
"endpoint": "notes.formsemestre_recapcomplet",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {
|
|
|
|
"formsemestre_id": formsemestre_id,
|
2023-02-12 01:13:43 +01:00
|
|
|
"mode_jury": 1,
|
2021-06-14 18:08:52 +02:00
|
|
|
},
|
2023-02-12 01:13:43 +01:00
|
|
|
"enabled": formsemestre.can_edit_jury(),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
2023-02-21 02:43:26 +01:00
|
|
|
{
|
|
|
|
"title": "Générer feuille préparation Jury (non BUT)",
|
|
|
|
"endpoint": "notes.feuille_preparation_jury",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
|
|
|
"enabled": not formsemestre.formation.is_apc(),
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
2022-03-07 21:49:11 +01:00
|
|
|
"title": "Éditer les PV et archiver les résultats",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_archive",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-02-12 01:13:43 +01:00
|
|
|
"enabled": formsemestre.can_edit_pv(),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Documents archivés",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_list_archives",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2023-12-23 13:53:02 +01:00
|
|
|
"enabled": sco_archives_formsemestre.PV_ARCHIVER.list_obj_archives(
|
|
|
|
formsemestre_id
|
|
|
|
),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2024-01-27 13:13:44 +01:00
|
|
|
menu_stats = _build_menu_stats(formsemestre)
|
2020-09-26 16:19:37 +02:00
|
|
|
H = [
|
|
|
|
'<ul id="sco_menu">',
|
2022-08-30 20:31:05 +02:00
|
|
|
htmlutils.make_menu("Semestre", menu_semestre),
|
|
|
|
htmlutils.make_menu("Inscriptions", menu_inscriptions),
|
|
|
|
htmlutils.make_menu("Groupes", menu_groupes),
|
|
|
|
htmlutils.make_menu("Notes", menu_notes),
|
|
|
|
htmlutils.make_menu("Jury", menu_jury),
|
|
|
|
htmlutils.make_menu("Statistiques", menu_stats),
|
2021-08-21 00:24:51 +02:00
|
|
|
formsemestre_custommenu_html(formsemestre_id),
|
2020-09-26 16:19:37 +02:00
|
|
|
"</ul>",
|
|
|
|
]
|
|
|
|
return "\n".join(H)
|
|
|
|
|
|
|
|
|
|
|
|
# Element HTML decrivant un semestre (barre de menu et infos)
|
2022-06-09 07:39:58 +02:00
|
|
|
def formsemestre_page_title(formsemestre_id=None):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Element HTML decrivant un semestre (barre de menu et infos)
|
2023-02-02 10:40:58 +01:00
|
|
|
Cherche dans la requete si un semestre est défini
|
|
|
|
via (formsemestre_id ou moduleimpl ou evaluation ou group)
|
2020-09-26 16:19:37 +02:00
|
|
|
"""
|
2022-06-09 07:39:58 +02:00
|
|
|
formsemestre_id = (
|
|
|
|
formsemestre_id
|
|
|
|
if formsemestre_id is not None
|
|
|
|
else retreive_formsemestre_from_request()
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
|
|
|
if not formsemestre_id:
|
|
|
|
return ""
|
|
|
|
try:
|
2021-09-13 19:36:53 +02:00
|
|
|
formsemestre_id = int(formsemestre_id)
|
2022-06-09 07:39:58 +02:00
|
|
|
except ValueError:
|
|
|
|
log(f"formsemestre_id: invalid type {formsemestre_id:r}")
|
2020-09-26 16:19:37 +02:00
|
|
|
return ""
|
2023-03-20 11:17:38 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-02-02 10:40:58 +01:00
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"formsemestre_page_title.j2",
|
2022-03-07 21:49:11 +01:00
|
|
|
formsemestre=formsemestre,
|
|
|
|
scu=scu,
|
2022-08-30 20:31:05 +02:00
|
|
|
sem_menu_bar=formsemestre_status_menubar(formsemestre),
|
2022-03-07 21:49:11 +01:00
|
|
|
)
|
2021-09-30 17:50:37 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-02-25 11:59:37 +01:00
|
|
|
# ---------
|
|
|
|
# ancienne fonction ScoDoc7 à supprimer lorsqu'on utilisera les modèles
|
|
|
|
# utilisé seulement par export Apogée
|
|
|
|
def fill_formsemestre(sem: dict): # XXX OBSOLETE
|
|
|
|
"""Add some fields in formsemestres dicts"""
|
|
|
|
formsemestre_id = sem["formsemestre_id"]
|
|
|
|
|
|
|
|
F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
|
|
|
sem["formation"] = F
|
|
|
|
parcours = codes_cursus.get_cursus_from_code(F["type_parcours"])
|
|
|
|
if sem["semestre_id"] != -1:
|
|
|
|
sem["num_sem"] = f""", {parcours.SESSION_NAME} {sem["semestre_id"]}"""
|
|
|
|
else:
|
|
|
|
sem["num_sem"] = "" # formation sans semestres
|
|
|
|
if sem["modalite"]:
|
|
|
|
sem["modalitestr"] = f""" en {sem["modalite"]}"""
|
|
|
|
else:
|
|
|
|
sem["modalitestr"] = ""
|
|
|
|
|
|
|
|
sem["etape_apo_str"] = "Code étape Apogée: " + (
|
|
|
|
sco_formsemestre.formsemestre_etape_apo_str(sem) or "Pas de code étape"
|
|
|
|
)
|
|
|
|
|
|
|
|
inscrits = sco_formsemestre_inscriptions.do_formsemestre_inscription_list(
|
|
|
|
args={"formsemestre_id": formsemestre_id}
|
|
|
|
)
|
|
|
|
sem["nbinscrits"] = len(inscrits)
|
|
|
|
uresps = [
|
|
|
|
sco_users.user_info(responsable_id) for responsable_id in sem["responsables"]
|
|
|
|
]
|
|
|
|
sem["resp"] = ", ".join([u["prenomnom"] for u in uresps])
|
|
|
|
sem["nomcomplet"] = ", ".join([u["nomcomplet"] for u in uresps])
|
|
|
|
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
# Description du semestre sous forme de table exportable
|
2022-05-22 07:02:01 +02:00
|
|
|
def formsemestre_description_table(
|
2022-09-23 11:23:48 +02:00
|
|
|
formsemestre_id: int, with_evals=False, with_parcours=False
|
2022-05-22 07:02:01 +02:00
|
|
|
):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Description du semestre sous forme de table exportable
|
|
|
|
Liste des modules et de leurs coefficients
|
|
|
|
"""
|
2022-10-05 23:48:54 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.filter_by(
|
|
|
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2023-06-03 23:18:54 +02:00
|
|
|
is_apc = formsemestre.formation.is_apc()
|
2022-02-13 23:53:11 +01:00
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
2021-07-28 17:03:54 +02:00
|
|
|
use_ue_coefs = sco_preferences.get_preference("use_ue_coefs", formsemestre_id)
|
2023-02-18 00:13:00 +01:00
|
|
|
parcours = codes_cursus.get_cursus_from_code(formsemestre.formation.type_parcours)
|
2022-09-22 23:25:12 +02:00
|
|
|
# --- Colonnes à proposer:
|
|
|
|
columns_ids = ["UE", "Code", "Module"]
|
|
|
|
if with_parcours:
|
|
|
|
columns_ids += ["parcours"]
|
|
|
|
if not formsemestre.formation.is_apc():
|
|
|
|
columns_ids += ["Coef."]
|
|
|
|
ues = [] # liste des UE, seulement en APC pour les coefs
|
|
|
|
else:
|
2023-04-03 17:46:31 +02:00
|
|
|
ues = formsemestre.get_ues()
|
2022-09-22 23:25:12 +02:00
|
|
|
columns_ids += [f"ue_{ue.id}" for ue in ues]
|
2023-06-03 23:18:54 +02:00
|
|
|
if sco_preferences.get_preference("bul_show_ects", formsemestre_id) and not is_apc:
|
2022-09-22 23:25:12 +02:00
|
|
|
columns_ids += ["ects"]
|
|
|
|
columns_ids += ["Inscrits", "Responsable", "Enseignants"]
|
|
|
|
if with_evals:
|
|
|
|
columns_ids += [
|
2023-08-25 17:58:57 +02:00
|
|
|
"date_evaluation",
|
2022-09-22 23:25:12 +02:00
|
|
|
"description",
|
|
|
|
"coefficient",
|
|
|
|
"evalcomplete_str",
|
|
|
|
"publish_incomplete_str",
|
|
|
|
]
|
|
|
|
|
|
|
|
titles = {title: title for title in columns_ids}
|
|
|
|
titles.update({f"ue_{ue.id}": ue.acronyme for ue in ues})
|
|
|
|
titles["ects"] = "ECTS"
|
2023-08-25 17:58:57 +02:00
|
|
|
titles["date_evaluation"] = "Évaluation"
|
2022-09-22 23:25:12 +02:00
|
|
|
titles["description"] = ""
|
|
|
|
titles["coefficient"] = "Coef. éval."
|
|
|
|
titles["evalcomplete_str"] = "Complète"
|
|
|
|
titles["parcours"] = "Parcours"
|
2023-01-22 21:09:26 +01:00
|
|
|
titles["publish_incomplete_str"] = "Toujours utilisée"
|
2022-09-22 23:25:12 +02:00
|
|
|
title = f"{parcours.SESSION_NAME.capitalize()} {formsemestre.titre_mois()}"
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-02-21 21:34:38 +01:00
|
|
|
rows = []
|
2020-09-26 16:19:37 +02:00
|
|
|
sum_coef = 0
|
|
|
|
sum_ects = 0
|
|
|
|
last_ue_id = None
|
2023-06-03 23:18:54 +02:00
|
|
|
formsemestre_parcours_ids = {p.id for p in formsemestre.parcours}
|
2022-09-22 23:25:12 +02:00
|
|
|
for modimpl in formsemestre.modimpls_sorted:
|
2020-09-26 16:19:37 +02:00
|
|
|
# Ligne UE avec ECTS:
|
2022-09-22 23:25:12 +02:00
|
|
|
ue = modimpl.module.ue
|
|
|
|
if ue.id != last_ue_id:
|
|
|
|
last_ue_id = ue.id
|
|
|
|
if ue.ects is None:
|
2020-09-26 16:19:37 +02:00
|
|
|
ects_str = "-"
|
|
|
|
else:
|
2022-09-22 23:25:12 +02:00
|
|
|
sum_ects += ue.ects
|
|
|
|
ects_str = ue.ects
|
2020-09-26 16:19:37 +02:00
|
|
|
ue_info = {
|
2022-09-22 23:25:12 +02:00
|
|
|
"UE": ue.acronyme,
|
2023-05-12 16:55:30 +02:00
|
|
|
"Code": "",
|
2020-09-26 16:19:37 +02:00
|
|
|
"ects": ects_str,
|
2022-09-22 23:25:12 +02:00
|
|
|
"Module": ue.titre,
|
2020-09-26 16:19:37 +02:00
|
|
|
"_css_row_class": "table_row_ue",
|
|
|
|
}
|
2023-08-27 14:27:50 +02:00
|
|
|
if use_ue_coefs and ue.type != UE_SPORT:
|
|
|
|
ue_info["Coef."] = ue.coefficient or "0."
|
|
|
|
ue_info["_Coef._class"] = "ue_coef"
|
|
|
|
if not ue.coefficient:
|
|
|
|
ue_info["_Coef._class"] += " ue_coef_nul"
|
2023-05-12 16:55:30 +02:00
|
|
|
if ue.color:
|
|
|
|
for k in list(ue_info.keys()):
|
|
|
|
if not k.startswith("_"):
|
2024-02-13 13:55:16 +01:00
|
|
|
ue_info[f"_{k}_td_attrs"] = (
|
|
|
|
f'style="background-color: {ue.color} !important;"'
|
|
|
|
)
|
2023-06-03 23:18:54 +02:00
|
|
|
if not is_apc:
|
2023-05-12 16:55:30 +02:00
|
|
|
# n'affiche la ligne UE qu'en formation classique
|
|
|
|
# car l'UE de rattachement n'a pas d'intérêt en BUT
|
|
|
|
rows.append(ue_info)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-02-02 15:16:55 +01:00
|
|
|
mod_nb_inscrits = nt.modimpls_results[modimpl.id].nb_inscrits_module
|
2022-09-22 23:25:12 +02:00
|
|
|
enseignants = ", ".join(ens.get_prenomnom() for ens in modimpl.enseignants)
|
|
|
|
|
2023-05-12 16:55:30 +02:00
|
|
|
row = {
|
2022-09-22 23:25:12 +02:00
|
|
|
"UE": modimpl.module.ue.acronyme,
|
2023-05-12 16:55:30 +02:00
|
|
|
"_UE_td_attrs": ue_info.get("_UE_td_attrs", ""),
|
2022-09-22 23:25:12 +02:00
|
|
|
"Code": modimpl.module.code or "",
|
2024-04-08 18:56:43 +02:00
|
|
|
"Module": modimpl.module.abbrev or modimpl.module.titre or "",
|
2020-09-26 16:19:37 +02:00
|
|
|
"_Module_class": "scotext",
|
2024-02-02 15:16:55 +01:00
|
|
|
"Inscrits": mod_nb_inscrits,
|
2022-09-22 23:25:12 +02:00
|
|
|
"Responsable": sco_users.user_info(modimpl.responsable_id)["nomprenom"],
|
2020-09-26 16:19:37 +02:00
|
|
|
"_Responsable_class": "scotext",
|
2020-12-24 01:00:41 +01:00
|
|
|
"Enseignants": enseignants,
|
|
|
|
"_Enseignants_class": "scotext",
|
2022-09-22 23:25:12 +02:00
|
|
|
"Coef.": modimpl.module.coefficient,
|
2020-09-26 16:19:37 +02:00
|
|
|
# 'ECTS' : M['module']['ects'],
|
|
|
|
# Lien sur titre -> module
|
2021-08-15 22:08:38 +02:00
|
|
|
"_Module_target": url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2022-09-22 23:25:12 +02:00
|
|
|
moduleimpl_id=modimpl.id,
|
2021-08-15 22:08:38 +02:00
|
|
|
),
|
|
|
|
"_Code_target": url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2022-09-22 23:25:12 +02:00
|
|
|
moduleimpl_id=modimpl.id,
|
2021-08-15 22:08:38 +02:00
|
|
|
),
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
2022-09-22 23:25:12 +02:00
|
|
|
if modimpl.module.coefficient is not None:
|
|
|
|
sum_coef += modimpl.module.coefficient
|
|
|
|
coef_dict = modimpl.module.get_ue_coef_dict()
|
|
|
|
for ue in ues:
|
2023-05-12 16:55:30 +02:00
|
|
|
row[f"ue_{ue.id}"] = coef_dict.get(ue.id, 0.0) or ""
|
2022-05-22 07:02:01 +02:00
|
|
|
if with_parcours:
|
2023-06-03 23:18:54 +02:00
|
|
|
# Intersection des parcours du module avec ceux du formsemestre
|
2023-05-12 16:55:30 +02:00
|
|
|
row["parcours"] = ", ".join(
|
2023-06-03 23:18:54 +02:00
|
|
|
[
|
|
|
|
pa.code
|
|
|
|
for pa in (
|
|
|
|
modimpl.module.parcours
|
|
|
|
if modimpl.module.parcours
|
|
|
|
else modimpl.formsemestre.parcours
|
|
|
|
)
|
|
|
|
if pa.id in formsemestre_parcours_ids
|
|
|
|
]
|
2022-09-22 23:25:12 +02:00
|
|
|
)
|
2022-05-22 07:02:01 +02:00
|
|
|
|
2023-05-12 16:55:30 +02:00
|
|
|
rows.append(row)
|
2022-05-22 07:02:01 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
if with_evals:
|
|
|
|
# Ajoute lignes pour evaluations
|
2024-02-02 15:16:55 +01:00
|
|
|
evals = nt.get_mod_evaluation_etat_list(modimpl)
|
2020-09-26 16:19:37 +02:00
|
|
|
evals.reverse() # ordre chronologique
|
|
|
|
# Ajoute etat:
|
2023-05-12 16:24:40 +02:00
|
|
|
eval_rows = []
|
2023-02-21 21:34:38 +01:00
|
|
|
for eval_dict in evals:
|
|
|
|
e = eval_dict.copy()
|
2023-05-12 16:24:40 +02:00
|
|
|
e["_description_target"] = url_for(
|
|
|
|
"notes.evaluation_listenotes",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
evaluation_id=e["evaluation_id"],
|
|
|
|
)
|
2023-08-25 17:58:57 +02:00
|
|
|
e["_date_evaluation_order"] = e["jour"].isoformat()
|
|
|
|
e["date_evaluation"] = (
|
2024-04-02 23:37:23 +02:00
|
|
|
e["jour"].strftime(scu.DATE_FMT) if e["jour"] else ""
|
2023-08-25 17:58:57 +02:00
|
|
|
)
|
2023-05-12 16:55:30 +02:00
|
|
|
e["UE"] = row["UE"]
|
|
|
|
e["_UE_td_attrs"] = row["_UE_td_attrs"]
|
|
|
|
e["Code"] = row["Code"]
|
2022-09-23 11:23:48 +02:00
|
|
|
e["_css_row_class"] = "evaluation"
|
|
|
|
e["Module"] = "éval."
|
2020-09-26 16:19:37 +02:00
|
|
|
# Cosmetic: conversions pour affichage
|
|
|
|
if e["etat"]["evalcomplete"]:
|
|
|
|
e["evalcomplete_str"] = "Oui"
|
|
|
|
e["_evalcomplete_str_td_attrs"] = 'style="color: green;"'
|
|
|
|
else:
|
|
|
|
e["evalcomplete_str"] = "Non"
|
|
|
|
e["_evalcomplete_str_td_attrs"] = 'style="color: red;"'
|
|
|
|
|
2021-08-11 00:36:07 +02:00
|
|
|
if e["publish_incomplete"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
e["publish_incomplete_str"] = "Oui"
|
|
|
|
e["_publish_incomplete_str_td_attrs"] = 'style="color: green;"'
|
|
|
|
else:
|
|
|
|
e["publish_incomplete_str"] = "Non"
|
|
|
|
e["_publish_incomplete_str_td_attrs"] = 'style="color: red;"'
|
2022-09-22 23:25:12 +02:00
|
|
|
# Poids vers UEs (en APC)
|
2023-07-11 06:57:38 +02:00
|
|
|
evaluation: Evaluation = db.session.get(Evaluation, e["evaluation_id"])
|
2022-09-22 23:25:12 +02:00
|
|
|
for ue_id, poids in evaluation.get_ue_poids_dict().items():
|
|
|
|
e[f"ue_{ue_id}"] = poids or ""
|
2022-09-23 11:23:48 +02:00
|
|
|
e[f"_ue_{ue_id}_class"] = "poids"
|
|
|
|
e[f"_ue_{ue_id}_help"] = "poids vers l'UE"
|
2023-05-12 16:24:40 +02:00
|
|
|
eval_rows.append(e)
|
2022-09-22 23:25:12 +02:00
|
|
|
|
2023-05-12 16:24:40 +02:00
|
|
|
rows += eval_rows
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
sums = {"_css_row_class": "moyenne sortbottom", "ects": sum_ects, "Coef.": sum_coef}
|
2023-02-21 21:34:38 +01:00
|
|
|
rows.append(sums)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
return GenTable(
|
2024-05-22 00:06:30 +02:00
|
|
|
base_url=f"{request.base_url}?formsemestre_id={formsemestre_id}&with_evals={with_evals}",
|
2020-09-26 16:19:37 +02:00
|
|
|
caption=title,
|
2024-05-22 00:06:30 +02:00
|
|
|
columns_ids=columns_ids,
|
2020-09-26 16:19:37 +02:00
|
|
|
html_caption=title,
|
|
|
|
html_class="table_leftalign formsemestre_description",
|
2021-06-13 19:12:20 +02:00
|
|
|
html_title=html_sco_header.html_sem_header(
|
2022-01-07 15:11:24 +01:00
|
|
|
"Description du semestre", with_page_header=False
|
2020-09-26 16:19:37 +02:00
|
|
|
),
|
2024-05-22 00:06:30 +02:00
|
|
|
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
|
|
|
page_title=title,
|
2020-09-26 16:19:37 +02:00
|
|
|
pdf_title=title,
|
2021-07-28 17:03:54 +02:00
|
|
|
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
2024-05-22 00:06:30 +02:00
|
|
|
rows=rows,
|
|
|
|
table_id="formsemestre_description_table",
|
|
|
|
titles=titles,
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-05-22 07:02:01 +02:00
|
|
|
def formsemestre_description(
|
2023-09-21 10:20:19 +02:00
|
|
|
formsemestre_id, fmt="html", with_evals=False, with_parcours=False
|
2022-05-22 07:02:01 +02:00
|
|
|
):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Description du semestre sous forme de table exportable
|
|
|
|
Liste des modules et de leurs coefficients
|
|
|
|
"""
|
|
|
|
with_evals = int(with_evals)
|
2022-05-22 07:02:01 +02:00
|
|
|
tab = formsemestre_description_table(
|
|
|
|
formsemestre_id, with_evals=with_evals, with_parcours=with_parcours
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-05-22 07:02:01 +02:00
|
|
|
tab.html_before_table = f"""
|
|
|
|
<form name="f" method="get" action="{request.base_url}">
|
|
|
|
<input type="hidden" name="formsemestre_id" value="{formsemestre_id}"></input>
|
2023-11-11 18:13:18 +01:00
|
|
|
<input type="checkbox" name="with_evals" value="1" onchange="document.f.submit()"
|
2022-05-22 07:02:01 +02:00
|
|
|
{ "checked" if with_evals else "" }
|
|
|
|
>indiquer les évaluations</input>
|
2023-11-11 18:13:18 +01:00
|
|
|
<input type="checkbox" name="with_parcours" value="1" onchange="document.f.submit()"
|
2022-05-22 07:02:01 +02:00
|
|
|
{ "checked" if with_parcours else "" }
|
|
|
|
>indiquer les parcours BUT</input>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-09-21 10:20:19 +02:00
|
|
|
return tab.make_page(fmt=fmt)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2021-06-02 22:40:34 +02:00
|
|
|
# genere liste html pour accès aux groupes de ce semestre
|
2023-09-18 22:47:25 +02:00
|
|
|
def _make_listes_sem(formsemestre: FormSemestre) -> str:
|
|
|
|
"""La section avec les groupes et l'assiduité"""
|
2021-06-02 22:40:34 +02:00
|
|
|
H = []
|
|
|
|
# pas de menu absences si pas autorise:
|
2023-09-29 21:17:31 +02:00
|
|
|
can_edit_abs = current_user.has_permission(Permission.AbsChange)
|
2021-06-02 22:40:34 +02:00
|
|
|
#
|
|
|
|
H.append(
|
2023-09-19 21:39:36 +02:00
|
|
|
f"""<h3>Groupes et absences de {formsemestre.titre}
|
|
|
|
<span class="infostitresem">({
|
|
|
|
formsemestre.mois_debut()} - {formsemestre.mois_fin()
|
|
|
|
})</span></h3>"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
|
|
|
#
|
2023-09-19 21:39:36 +02:00
|
|
|
H.append('<div class="sem-groups-abs">')
|
2024-07-09 15:23:36 +02:00
|
|
|
|
|
|
|
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
|
|
|
|
show_abs: str = "hidden" if disable_abs else ""
|
|
|
|
|
2021-06-02 22:40:34 +02:00
|
|
|
# Genere liste pour chaque partition (categorie de groupes)
|
2023-09-19 21:39:36 +02:00
|
|
|
for partition in formsemestre.get_partitions_list():
|
|
|
|
groups = partition.groups.all()
|
2023-09-20 19:09:02 +02:00
|
|
|
effectifs = {g.id: g.get_nb_inscrits() for g in groups}
|
2023-09-19 21:39:36 +02:00
|
|
|
partition_is_empty = sum(effectifs.values()) == 0
|
|
|
|
H.append(
|
|
|
|
f"""
|
|
|
|
<div class="sem-groups-partition">
|
|
|
|
<div class="sem-groups-partition-titre">{
|
|
|
|
'Groupes de ' + partition.partition_name
|
|
|
|
if partition.partition_name else
|
2024-06-18 01:21:33 +02:00
|
|
|
('aucun étudiant inscrit' if partition_is_empty else 'Tous les étudiants')}
|
2023-09-19 21:39:36 +02:00
|
|
|
</div>
|
|
|
|
<div class="sem-groups-partition-titre">{
|
2024-07-09 15:23:36 +02:00
|
|
|
"Assiduité" if not partition_is_empty and not show_abs else ""
|
2023-09-19 21:39:36 +02:00
|
|
|
}</div>
|
|
|
|
"""
|
|
|
|
)
|
2024-07-09 15:23:36 +02:00
|
|
|
|
2021-06-02 22:40:34 +02:00
|
|
|
if groups:
|
|
|
|
for group in groups:
|
2023-09-19 21:39:36 +02:00
|
|
|
n_members = effectifs[group.id]
|
2023-06-09 20:36:31 +02:00
|
|
|
if n_members == 0:
|
|
|
|
continue # skip empty groups
|
|
|
|
partition_is_empty = False
|
2023-09-19 21:39:36 +02:00
|
|
|
group_label = f"{group.group_name}" if group.group_name else "liste"
|
2021-06-02 22:40:34 +02:00
|
|
|
H.append(
|
2021-07-26 16:52:38 +02:00
|
|
|
f"""
|
2023-09-19 21:39:36 +02:00
|
|
|
<div class="sem-groups-list">
|
|
|
|
<div>
|
2023-10-07 09:32:35 +02:00
|
|
|
<a class="stdlink" href="{
|
2023-09-19 21:39:36 +02:00
|
|
|
url_for("scolar.groups_view",
|
|
|
|
group_ids=group.id,
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
)
|
|
|
|
}">{group_label}
|
|
|
|
- {n_members} étudiants</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-09 15:23:36 +02:00
|
|
|
<div class="sem-groups-assi {show_abs}">
|
2021-07-26 16:52:38 +02:00
|
|
|
"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
2023-09-19 21:39:36 +02:00
|
|
|
if can_edit_abs:
|
|
|
|
H.append(
|
|
|
|
f"""
|
|
|
|
<div>
|
2024-03-20 18:13:19 +01:00
|
|
|
<a class="stdlink" href="{
|
2023-09-19 21:39:36 +02:00
|
|
|
url_for("assiduites.signal_assiduites_group",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2024-05-30 10:51:24 +02:00
|
|
|
day=datetime.date.today().isoformat(),
|
2023-09-19 21:39:36 +02:00
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
group_ids=group.id,
|
|
|
|
)}">
|
2024-05-23 08:59:10 +02:00
|
|
|
Saisir l'assiduité</a>
|
2023-09-19 21:39:36 +02:00
|
|
|
</div>
|
2024-05-29 16:29:34 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
# YYYY-Www (ISO 8601) :
|
|
|
|
current_week: str = datetime.datetime.now().strftime("%G-W%V")
|
|
|
|
H.append(
|
|
|
|
f"""
|
|
|
|
<div>
|
|
|
|
<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,
|
2024-05-29 19:09:06 +02:00
|
|
|
)}">Saisie hebdomadaire</a>
|
2024-05-29 16:29:34 +02:00
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
if can_edit_abs:
|
|
|
|
H.append(
|
|
|
|
f"""
|
2023-09-19 21:39:36 +02:00
|
|
|
<div>
|
2024-03-20 18:13:19 +01:00
|
|
|
<a class="stdlink" href="{
|
2024-05-23 09:07:50 +02:00
|
|
|
url_for("assiduites.bilan_dept",
|
2023-09-19 21:39:36 +02:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
group_ids=group.id,
|
|
|
|
)}">
|
2024-05-23 09:07:50 +02:00
|
|
|
Justificatifs en attente</a>
|
2023-09-19 21:39:36 +02:00
|
|
|
</div>
|
2024-05-29 16:29:34 +02:00
|
|
|
"""
|
2024-05-23 09:07:50 +02:00
|
|
|
)
|
|
|
|
H.append(
|
|
|
|
f"""
|
|
|
|
<div>
|
|
|
|
<a class="stdlink" href="{
|
|
|
|
url_for("assiduites.visu_assi_group",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
date_debut=formsemestre.date_debut.isoformat(),
|
|
|
|
date_fin=formsemestre.date_fin.isoformat(),
|
|
|
|
group_ids=group.id,
|
|
|
|
)}">
|
|
|
|
Bilan</a>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
|
2023-09-19 21:39:36 +02:00
|
|
|
H.append("</div>") # /sem-groups-assi
|
2024-06-18 01:21:33 +02:00
|
|
|
if partition_is_empty and not partition.is_default():
|
2023-09-19 21:39:36 +02:00
|
|
|
H.append(
|
|
|
|
'<div class="help sem-groups-none">Aucun groupe peuplé dans cette partition'
|
|
|
|
)
|
2023-09-02 22:19:35 +02:00
|
|
|
if formsemestre.can_change_groups():
|
2021-06-02 22:40:34 +02:00
|
|
|
H.append(
|
2023-07-21 09:25:39 +02:00
|
|
|
f""" (<a href="{url_for("scolar.partition_editor",
|
2023-11-11 18:13:18 +01:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
2023-07-21 09:25:39 +02:00
|
|
|
edit_partition=1)
|
2021-08-16 08:33:12 +02:00
|
|
|
}" class="stdlink">créer</a>)"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
2023-09-19 21:39:36 +02:00
|
|
|
H.append("</div>")
|
|
|
|
H.append("</div>") # /sem-groups-partition
|
|
|
|
|
2023-09-02 22:19:35 +02:00
|
|
|
if formsemestre.can_change_groups():
|
2021-06-02 22:40:34 +02:00
|
|
|
H.append(
|
2023-07-30 20:00:05 +02:00
|
|
|
f"""<h4><a class="stdlink"
|
|
|
|
href="{url_for("scolar.partition_editor",
|
2023-11-11 18:13:18 +01:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
2023-07-30 20:00:05 +02:00
|
|
|
edit_partition=1)
|
2021-07-26 16:52:38 +02:00
|
|
|
}">Ajouter une partition</a></h4>"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
|
|
|
|
2024-07-04 16:46:07 +02:00
|
|
|
# --- Formulaire importation Assiduité excel (si autorisé)
|
2024-07-09 15:23:36 +02:00
|
|
|
if current_user.has_permission(Permission.AbsChange) and not disable_abs:
|
2024-07-04 16:46:07 +02:00
|
|
|
H.append(
|
|
|
|
f"""<p>
|
|
|
|
<a class="stdlink" href="{url_for('assiduites.feuille_abs_formsemestre',
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id)}">
|
|
|
|
Importation de l'assiduité depuis un fichier excel</a>
|
|
|
|
</p>"""
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Lien Traitement Justificatifs:
|
|
|
|
|
2024-07-09 15:23:36 +02:00
|
|
|
if (
|
|
|
|
current_user.has_permission(Permission.AbsJustifView)
|
|
|
|
and current_user.has_permission(Permission.JustifValidate)
|
|
|
|
and not disable_abs
|
|
|
|
):
|
2024-07-04 16:46:07 +02:00
|
|
|
H.append(
|
|
|
|
f"""<p>
|
|
|
|
<a class="stdlink" href="{url_for('assiduites.traitement_justificatifs',
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id)}">
|
|
|
|
Traitement des justificatifs d'absence</a>
|
|
|
|
</p>"""
|
|
|
|
)
|
|
|
|
|
2021-06-02 22:40:34 +02:00
|
|
|
H.append("</div>")
|
2024-07-09 15:23:36 +02:00
|
|
|
|
|
|
|
if disable_abs:
|
|
|
|
H.append(f"""
|
|
|
|
<div class="scobox" style="width:fit-content;">
|
|
|
|
<p>La gestion des absences est désactivée dans ScoDoc pour ce semestre:</p>
|
|
|
|
<p>{disable_abs}</p>
|
|
|
|
</div>
|
|
|
|
""")
|
|
|
|
|
2021-06-02 22:40:34 +02:00
|
|
|
return "\n".join(H)
|
|
|
|
|
|
|
|
|
2022-12-17 13:18:10 +01:00
|
|
|
def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None):
|
2020-10-14 15:28:09 +02:00
|
|
|
"""En-tête HTML des pages "semestre" """
|
2024-02-02 15:16:55 +01:00
|
|
|
formsemestre: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
|
|
|
if not formsemestre:
|
2022-01-07 15:11:24 +01:00
|
|
|
raise ScoValueError("Semestre inexistant (il a peut être été supprimé ?)")
|
2024-02-02 15:16:55 +01:00
|
|
|
formation: Formation = formsemestre.formation
|
2023-02-12 13:36:47 +01:00
|
|
|
parcours = formation.get_cursus()
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
page_title = page_title or "Modules de "
|
|
|
|
|
|
|
|
H = [
|
2021-06-13 19:12:20 +02:00
|
|
|
html_sco_header.html_sem_header(
|
2022-01-07 15:11:24 +01:00
|
|
|
page_title, with_page_header=False, with_h2=False
|
2020-09-26 16:19:37 +02:00
|
|
|
),
|
2021-09-15 20:24:44 +02:00
|
|
|
f"""<table>
|
2020-09-26 16:19:37 +02:00
|
|
|
<tr><td class="fichetitre2">Formation: </td><td>
|
2023-02-02 10:40:58 +01:00
|
|
|
<a href="{url_for('notes.ue_table',
|
2024-02-02 15:16:55 +01:00
|
|
|
scodoc_dept=g.scodoc_dept, formation_id=formsemestre.formation.id)}"
|
2022-01-07 15:11:24 +01:00
|
|
|
class="discretelink" title="Formation {
|
|
|
|
formation.acronyme}, v{formation.version}">{formation.titre}</a>
|
|
|
|
""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2024-02-02 15:16:55 +01:00
|
|
|
if formsemestre.semestre_id >= 0:
|
|
|
|
H.append(f", {parcours.SESSION_NAME} {formsemestre.semestre_id}")
|
|
|
|
if formsemestre.modalite:
|
|
|
|
H.append(f" en {formsemestre.modalite}")
|
|
|
|
if formsemestre.etapes:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-01-07 15:11:24 +01:00
|
|
|
f""" (étape <b><tt>{
|
2024-02-02 15:16:55 +01:00
|
|
|
formsemestre.etapes_apo_str() or "-"
|
2022-01-07 15:11:24 +01:00
|
|
|
}</tt></b>)"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append("</td></tr>")
|
2022-12-17 13:18:10 +01:00
|
|
|
if formation.is_apc():
|
|
|
|
# Affiche les parcours BUT cochés. Si aucun, tous ceux du référentiel.
|
2024-02-02 15:16:55 +01:00
|
|
|
sem_parcours = formsemestre.get_parcours_apc()
|
2022-05-22 03:26:39 +02:00
|
|
|
H.append(
|
|
|
|
f"""
|
|
|
|
<tr><td class="fichetitre2">Parcours: </td>
|
2022-12-17 13:18:10 +01:00
|
|
|
<td style="color: blue;">{', '.join(parcours.code for parcours in sem_parcours)}</td>
|
2022-05-22 03:26:39 +02:00
|
|
|
</tr>
|
|
|
|
"""
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-02-02 15:16:55 +01:00
|
|
|
evals = sco_evaluations.do_evaluation_etat_in_sem(formsemestre)
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-05-22 03:26:39 +02:00
|
|
|
'<tr><td class="fichetitre2">Évaluations: </td><td> %(nb_evals_completes)s ok, %(nb_evals_en_cours)s en cours, %(nb_evals_vides)s vides'
|
2020-09-26 16:19:37 +02:00
|
|
|
% evals
|
|
|
|
)
|
|
|
|
if evals["last_modif"]:
|
|
|
|
H.append(
|
|
|
|
" <em>(dernière note saisie le %s)</em>"
|
|
|
|
% evals["last_modif"].strftime("%d/%m/%Y à %Hh%M")
|
|
|
|
)
|
|
|
|
H.append("</td></tr>")
|
2022-10-06 14:06:02 +02:00
|
|
|
H.append("</table>")
|
|
|
|
warnings = []
|
2020-09-26 16:19:37 +02:00
|
|
|
if evals["attente"]:
|
2022-10-06 14:06:02 +02:00
|
|
|
warnings.append(
|
|
|
|
"""<span class="fontred">Il y a des notes en attente !</span>
|
|
|
|
Le classement des étudiants n'a qu'une valeur indicative."""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-02 15:16:55 +01:00
|
|
|
if formsemestre.bul_hide_xml:
|
2023-09-22 22:53:35 +02:00
|
|
|
warnings.append("""Bulletins non publiés sur la passerelle.""")
|
2024-02-02 15:16:55 +01:00
|
|
|
if formsemestre.block_moyennes:
|
2022-10-06 14:06:02 +02:00
|
|
|
warnings.append("Calcul des moyennes bloqué !")
|
2024-02-02 15:16:55 +01:00
|
|
|
if formsemestre.semestre_id >= 0 and not formsemestre.est_sur_une_annee():
|
2022-10-06 14:06:02 +02:00
|
|
|
warnings.append("""<em>Ce semestre couvre plusieurs années scolaires !</em>""")
|
|
|
|
if warnings:
|
|
|
|
H += [
|
|
|
|
f"""<div class="formsemestre_status_warning">{warning}</div>"""
|
|
|
|
for warning in warnings
|
|
|
|
]
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
return "".join(H)
|
|
|
|
|
|
|
|
|
2022-12-17 14:05:13 +01:00
|
|
|
def formsemestre_status(formsemestre_id=None, check_parcours=True):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Tableau de bord semestre HTML"""
|
|
|
|
# porté du DTML
|
2022-09-18 16:53:00 +02:00
|
|
|
if formsemestre_id is not None and not isinstance(formsemestre_id, int):
|
|
|
|
raise ScoInvalidIdType(
|
|
|
|
"formsemestre_bulletinetud: formsemestre_id must be an integer !"
|
|
|
|
)
|
2022-09-07 17:40:40 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
2022-12-17 13:43:47 +01:00
|
|
|
# S'assure que les groupes de parcours sont à jour:
|
2022-12-17 14:05:13 +01:00
|
|
|
if int(check_parcours):
|
|
|
|
formsemestre.setup_parcours_groups()
|
2024-02-02 15:16:55 +01:00
|
|
|
modimpls = formsemestre.modimpls_sorted
|
2022-02-06 16:09:17 +01:00
|
|
|
nt = res_sem.load_formsemestre_results(formsemestre)
|
2022-01-08 18:06:00 +01:00
|
|
|
|
2021-11-12 22:17:46 +01:00
|
|
|
# Construit la liste de tous les enseignants de ce semestre:
|
2022-09-07 17:40:40 +02:00
|
|
|
mails_enseignants = set(u.email for u in formsemestre.responsables)
|
2021-11-12 22:17:46 +01:00
|
|
|
for modimpl in modimpls:
|
2024-02-02 15:16:55 +01:00
|
|
|
mails_enseignants.add(sco_users.user_info(modimpl.responsable_id)["email"])
|
|
|
|
mails_enseignants |= {u.email for u in modimpl.enseignants if u.email}
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2022-09-07 17:40:40 +02:00
|
|
|
can_edit = formsemestre.can_be_edited_by(current_user)
|
2023-09-29 21:17:31 +02:00
|
|
|
can_change_all_notes = current_user.has_permission(Permission.EditAllNotes) or (
|
2022-10-06 14:06:02 +02:00
|
|
|
current_user.id in [resp.id for resp in formsemestre.responsables]
|
|
|
|
)
|
2021-11-12 22:17:46 +01:00
|
|
|
use_ue_coefs = sco_preferences.get_preference("use_ue_coefs", formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H = [
|
2022-04-21 16:35:27 +02:00
|
|
|
html_sco_header.sco_header(
|
|
|
|
page_title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}"
|
|
|
|
),
|
2020-09-26 16:19:37 +02:00
|
|
|
'<div class="formsemestre_status">',
|
|
|
|
formsemestre_status_head(
|
2021-08-21 00:24:51 +02:00
|
|
|
formsemestre_id=formsemestre_id, page_title="Tableau de bord"
|
2020-09-26 16:19:37 +02:00
|
|
|
),
|
2023-04-03 17:46:31 +02:00
|
|
|
formsemestre_warning_apc_setup(formsemestre, nt),
|
2024-02-13 13:55:16 +01:00
|
|
|
(
|
|
|
|
formsemestre_warning_etuds_sans_note(formsemestre, nt)
|
|
|
|
if can_change_all_notes
|
|
|
|
else ""
|
|
|
|
),
|
2023-01-09 11:26:27 +01:00
|
|
|
"""<p style="font-size: 130%"><b>Tableau de bord : </b>""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2023-01-09 11:26:27 +01:00
|
|
|
if formsemestre.est_courant():
|
|
|
|
H.append(
|
|
|
|
"""<span class="help">cliquez sur un module pour saisir des notes</span>"""
|
|
|
|
)
|
|
|
|
elif datetime.date.today() > formsemestre.date_fin:
|
2023-01-13 23:23:18 +01:00
|
|
|
if formsemestre.etat:
|
|
|
|
H.append(
|
2023-02-02 10:40:58 +01:00
|
|
|
"""<span
|
|
|
|
class="formsemestre_status_warning">semestre terminé mais non verrouillé</span>"""
|
2023-01-13 23:23:18 +01:00
|
|
|
)
|
2023-01-09 11:26:27 +01:00
|
|
|
else:
|
|
|
|
H.append(
|
|
|
|
"""<span class="formsemestre_status_warning">semestre pas encore commencé</span>"""
|
|
|
|
)
|
|
|
|
H.append("</p>")
|
2021-11-12 22:17:46 +01:00
|
|
|
|
2023-01-08 14:01:09 +01:00
|
|
|
if sco_preferences.get_preference("bul_show_all_evals", formsemestre_id):
|
|
|
|
H.append(
|
2023-02-02 10:40:58 +01:00
|
|
|
"""<div class="formsemestre_status_warning"
|
|
|
|
>Toutes évaluations (même incomplètes) visibles</div>"""
|
2023-01-08 14:01:09 +01:00
|
|
|
)
|
|
|
|
|
2021-11-12 22:17:46 +01:00
|
|
|
if nt.parcours.APC_SAE:
|
|
|
|
# BUT: tableau ressources puis SAE
|
|
|
|
ressources = [
|
2024-02-02 15:16:55 +01:00
|
|
|
m for m in modimpls if m.module.module_type == ModuleType.RESSOURCE
|
2021-11-12 22:17:46 +01:00
|
|
|
]
|
2024-02-02 15:16:55 +01:00
|
|
|
saes = [m for m in modimpls if m.module.module_type == ModuleType.SAE]
|
2021-11-12 22:17:46 +01:00
|
|
|
autres = [
|
|
|
|
m
|
|
|
|
for m in modimpls
|
2024-02-02 15:16:55 +01:00
|
|
|
if m.module.module_type not in (ModuleType.RESSOURCE, ModuleType.SAE)
|
2021-11-12 22:17:46 +01:00
|
|
|
]
|
|
|
|
H += [
|
2022-09-07 17:40:40 +02:00
|
|
|
f"""
|
2021-11-12 22:17:46 +01:00
|
|
|
<div class="tableau_modules">
|
2022-09-07 17:40:40 +02:00
|
|
|
{_TABLEAU_MODULES_HEAD}
|
|
|
|
<tr class="formsemestre_status_cat">
|
|
|
|
<td colspan="5">
|
|
|
|
<span class="status_module_cat">Ressources</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{formsemestre_tableau_modules(
|
2022-12-09 04:24:32 +01:00
|
|
|
ressources, nt, formsemestre, can_edit=can_edit, show_ues=False
|
2022-09-07 17:40:40 +02:00
|
|
|
)}
|
|
|
|
<tr class="formsemestre_status_cat">
|
|
|
|
<td colspan="5">
|
|
|
|
<span class="status_module_cat">SAÉs</span>
|
|
|
|
</td>
|
|
|
|
</tr>""",
|
2021-11-12 22:17:46 +01:00
|
|
|
formsemestre_tableau_modules(
|
2022-12-09 04:24:32 +01:00
|
|
|
saes, nt, formsemestre, can_edit=can_edit, show_ues=False
|
2021-11-12 22:17:46 +01:00
|
|
|
),
|
|
|
|
]
|
|
|
|
if autres:
|
|
|
|
H += [
|
2022-09-07 17:40:40 +02:00
|
|
|
"""<tr class="formsemestre_status_cat">
|
2021-11-12 22:17:46 +01:00
|
|
|
<td colspan="5">
|
|
|
|
<span class="status_module_cat">Autres modules</span>
|
|
|
|
</td></tr>""",
|
|
|
|
formsemestre_tableau_modules(
|
2022-12-09 04:24:32 +01:00
|
|
|
autres, nt, formsemestre, can_edit=can_edit, show_ues=False
|
2021-11-12 22:17:46 +01:00
|
|
|
),
|
|
|
|
]
|
|
|
|
H += [_TABLEAU_MODULES_FOOT, "</div>"]
|
|
|
|
else:
|
|
|
|
# formations classiques: groupe par UE
|
2023-12-15 01:07:08 +01:00
|
|
|
# élimine les modules BUT qui aurait pu se glisser là suite à un
|
|
|
|
# changement de type de formation par exemple
|
|
|
|
modimpls_classic = [
|
|
|
|
m
|
|
|
|
for m in modimpls
|
2024-02-02 15:16:55 +01:00
|
|
|
if m.module.module_type not in (ModuleType.RESSOURCE, ModuleType.SAE)
|
2023-12-15 01:07:08 +01:00
|
|
|
]
|
2021-11-12 22:17:46 +01:00
|
|
|
H += [
|
|
|
|
"<p>",
|
|
|
|
_TABLEAU_MODULES_HEAD,
|
|
|
|
formsemestre_tableau_modules(
|
2023-12-15 01:07:08 +01:00
|
|
|
modimpls_classic,
|
2021-11-12 22:17:46 +01:00
|
|
|
nt,
|
2022-12-09 04:24:32 +01:00
|
|
|
formsemestre,
|
2021-11-12 22:17:46 +01:00
|
|
|
can_edit=can_edit,
|
|
|
|
use_ue_coefs=use_ue_coefs,
|
|
|
|
),
|
|
|
|
_TABLEAU_MODULES_FOOT,
|
|
|
|
"</p>",
|
|
|
|
]
|
|
|
|
|
2022-02-27 20:12:20 +01:00
|
|
|
if use_ue_coefs and not formsemestre.formation.is_apc():
|
2021-11-12 22:17:46 +01:00
|
|
|
H.append(
|
|
|
|
"""
|
|
|
|
<p class="infop">utilise les coefficients d'UE pour calculer la moyenne générale.</p>
|
2020-09-26 16:19:37 +02:00
|
|
|
"""
|
2021-11-12 22:17:46 +01:00
|
|
|
)
|
|
|
|
# --- LISTE DES ETUDIANTS
|
|
|
|
H += [
|
2023-09-19 21:39:36 +02:00
|
|
|
'<div class="formsemestre-groupes">',
|
2022-09-07 17:40:40 +02:00
|
|
|
_make_listes_sem(formsemestre),
|
2021-11-12 22:17:46 +01:00
|
|
|
"</div>",
|
|
|
|
]
|
2024-03-22 15:41:39 +01:00
|
|
|
|
2021-11-12 22:17:46 +01:00
|
|
|
# --- Lien mail enseignants:
|
2022-09-08 09:46:16 +02:00
|
|
|
adrlist = list(mails_enseignants - {None, ""})
|
2021-11-12 22:17:46 +01:00
|
|
|
if adrlist:
|
|
|
|
H.append(
|
2024-02-02 15:16:55 +01:00
|
|
|
f"""<p>
|
|
|
|
<a class="stdlink" href="mailto:?cc={','.join(adrlist)}">Courrier aux {
|
|
|
|
len(adrlist)} enseignants du semestre</a>
|
|
|
|
</p>"""
|
2021-11-12 22:17:46 +01:00
|
|
|
)
|
|
|
|
return "".join(H) + html_sco_header.sco_footer()
|
|
|
|
|
|
|
|
|
|
|
|
_TABLEAU_MODULES_HEAD = """
|
2020-09-26 16:19:37 +02:00
|
|
|
<table class="formsemestre_status">
|
|
|
|
<tr>
|
|
|
|
<th class="formsemestre_status">Code</th>
|
|
|
|
<th class="formsemestre_status">Module</th>
|
|
|
|
<th class="formsemestre_status">Inscrits</th>
|
|
|
|
<th class="resp">Responsable</th>
|
2022-01-25 10:45:13 +01:00
|
|
|
<th class="coef">Coefs.</th>
|
2021-11-12 22:17:46 +01:00
|
|
|
<th class="evals">Évaluations</th>
|
|
|
|
</tr>
|
|
|
|
"""
|
|
|
|
_TABLEAU_MODULES_FOOT = """</table>"""
|
|
|
|
|
|
|
|
|
|
|
|
def formsemestre_tableau_modules(
|
2024-02-02 15:16:55 +01:00
|
|
|
modimpls: list[ModuleImpl],
|
2022-09-23 11:23:48 +02:00
|
|
|
nt,
|
2022-12-09 04:24:32 +01:00
|
|
|
formsemestre: FormSemestre,
|
2022-09-23 11:23:48 +02:00
|
|
|
can_edit=True,
|
|
|
|
show_ues=True,
|
|
|
|
use_ue_coefs=False,
|
2021-11-12 22:17:46 +01:00
|
|
|
) -> str:
|
|
|
|
"Lignes table HTML avec modules du semestre"
|
|
|
|
H = []
|
|
|
|
prev_ue_id = None
|
|
|
|
for modimpl in modimpls:
|
2024-02-02 15:16:55 +01:00
|
|
|
mod: Module = modimpl.module
|
2023-02-02 10:40:58 +01:00
|
|
|
moduleimpl_status_url = url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2024-02-02 15:16:55 +01:00
|
|
|
moduleimpl_id=modimpl.id,
|
2023-02-02 10:40:58 +01:00
|
|
|
)
|
2021-12-13 10:20:16 +01:00
|
|
|
mod_descr = "Module " + (mod.titre or "")
|
2024-02-21 22:39:12 +01:00
|
|
|
is_apc = mod.is_apc() # SAE ou ressource
|
|
|
|
if is_apc:
|
2024-05-29 11:55:28 +02:00
|
|
|
mod_descr += " " + mod.get_ue_coefs_descr()
|
2021-12-10 15:27:52 +01:00
|
|
|
else:
|
|
|
|
mod_descr += ", coef. " + str(mod.coefficient)
|
2024-02-02 15:16:55 +01:00
|
|
|
mod_ens = sco_users.user_info(modimpl.responsable_id)["nomcomplet"]
|
|
|
|
if modimpl.enseignants.count():
|
2021-11-12 22:17:46 +01:00
|
|
|
mod_ens += " (resp.), " + ", ".join(
|
2024-02-02 15:16:55 +01:00
|
|
|
[u.get_nomcomplet() for u in modimpl.enseignants]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-02 15:16:55 +01:00
|
|
|
mod_nb_inscrits = nt.modimpls_results[modimpl.id].nb_inscrits_module
|
2024-02-21 22:39:12 +01:00
|
|
|
mod_is_conforme = modimpl.check_apc_conformity(nt)
|
2024-02-02 15:16:55 +01:00
|
|
|
ue = modimpl.module.ue
|
|
|
|
if show_ues and (prev_ue_id != ue.id):
|
|
|
|
prev_ue_id = ue.id
|
2024-02-13 13:55:16 +01:00
|
|
|
titre = ue.titre or ""
|
2021-11-12 22:17:46 +01:00
|
|
|
if use_ue_coefs:
|
2024-02-02 15:16:55 +01:00
|
|
|
titre += f""" <b>(coef. {ue.coefficient or 0.0})</b>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-02-21 22:39:12 +01:00
|
|
|
f"""<tr class="formsemestre_status_ue">
|
|
|
|
<td colspan="4">
|
|
|
|
<span class="status_ue_acro">{ue.acronyme}</span>
|
|
|
|
<span class="status_ue_title">{titre}</span>
|
|
|
|
</td>
|
|
|
|
<td colspan="2">"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2021-11-12 22:17:46 +01:00
|
|
|
|
|
|
|
expr = sco_compute_moy.get_ue_expression(
|
2024-02-02 15:16:55 +01:00
|
|
|
formsemestre.id, ue.id, html_quote=True
|
2021-11-12 22:17:46 +01:00
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
if expr:
|
|
|
|
H.append(
|
2022-02-01 17:42:43 +01:00
|
|
|
f""" <span class="formula" title="mode de calcul de la moyenne d'UE">{expr}</span>
|
2024-02-27 21:51:43 +01:00
|
|
|
<span class="warning">formule inutilisée en ScoDoc 9: <a href="{
|
2024-02-02 15:16:55 +01:00
|
|
|
url_for("notes.delete_ue_expr", scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id, ue_id=ue.id )
|
2022-02-01 17:42:43 +01:00
|
|
|
}
|
|
|
|
">supprimer</a></span>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H.append("</td></tr>")
|
|
|
|
|
2024-02-02 15:16:55 +01:00
|
|
|
if ue.type != codes_cursus.UE_STANDARD:
|
2020-09-26 16:19:37 +02:00
|
|
|
fontorange = " fontorange" # style css additionnel
|
|
|
|
else:
|
|
|
|
fontorange = ""
|
|
|
|
|
2024-02-02 15:16:55 +01:00
|
|
|
etat = sco_evaluations.do_evaluation_etat_in_mod(nt, modimpl)
|
2020-09-26 16:19:37 +02:00
|
|
|
if (
|
|
|
|
etat["nb_evals_completes"] > 0
|
|
|
|
and etat["nb_evals_en_cours"] == 0
|
|
|
|
and etat["nb_evals_vides"] == 0
|
2024-02-04 18:36:11 +01:00
|
|
|
and not etat["attente"]
|
2024-02-26 13:55:04 +01:00
|
|
|
and not etat["nb_evals_blocked"] > 0
|
2020-09-26 16:19:37 +02:00
|
|
|
):
|
2024-02-21 22:39:12 +01:00
|
|
|
tr_classes = f"formsemestre_status_green{fontorange}"
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2024-02-21 22:39:12 +01:00
|
|
|
tr_classes = f"formsemestre_status{fontorange}"
|
|
|
|
if etat["attente"]:
|
|
|
|
tr_classes += " modimpl_attente"
|
|
|
|
if not mod_is_conforme:
|
|
|
|
tr_classes += " modimpl_non_conforme"
|
2024-02-26 13:55:04 +01:00
|
|
|
if etat["nb_evals_blocked"] > 0:
|
|
|
|
tr_classes += " modimpl_has_blocked"
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2023-02-02 10:40:58 +01:00
|
|
|
f"""
|
2024-02-21 22:39:12 +01:00
|
|
|
<tr class="{tr_classes}">
|
|
|
|
<td class="formsemestre_status_code"><a
|
2023-02-02 10:40:58 +01:00
|
|
|
href="{moduleimpl_status_url}"
|
|
|
|
title="{mod_descr}" class="stdlink">{mod.code}</a></td>
|
2023-11-11 18:13:18 +01:00
|
|
|
<td class="scotext"><a href="{moduleimpl_status_url}" title="{mod_descr}"
|
2023-02-02 10:40:58 +01:00
|
|
|
class="formsemestre_status_link">{mod.abbrev or mod.titre or ""}</a>
|
2022-09-23 11:23:48 +02:00
|
|
|
</td>
|
2024-02-02 15:16:55 +01:00
|
|
|
<td class="formsemestre_status_inscrits">{mod_nb_inscrits}</td>
|
2022-09-23 11:23:48 +02:00
|
|
|
<td class="resp scotext">
|
2023-02-02 10:40:58 +01:00
|
|
|
<a class="discretelink" href="{moduleimpl_status_url}" title="{mod_ens}">{
|
2024-02-02 15:16:55 +01:00
|
|
|
sco_users.user_info(modimpl.responsable_id)["prenomnom"]
|
2023-02-02 10:40:58 +01:00
|
|
|
}</a>
|
2022-09-23 11:23:48 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-01-25 10:45:13 +01:00
|
|
|
if mod.module_type in (ModuleType.RESSOURCE, ModuleType.SAE):
|
2023-04-03 17:46:31 +02:00
|
|
|
coefs = mod.ue_coefs_list(ues=formsemestre.get_ues())
|
2022-04-10 18:17:57 +02:00
|
|
|
H.append(f'<a class="invisible_link" href="#" title="{mod_descr}">')
|
2022-01-25 10:45:13 +01:00
|
|
|
for coef in coefs:
|
|
|
|
if coef[1] > 0:
|
|
|
|
H.append(
|
2022-09-08 01:20:04 +02:00
|
|
|
f"""<span class="mod_coef_indicator"
|
2022-01-25 10:45:13 +01:00
|
|
|
title="{coef[0].acronyme}"
|
|
|
|
style="background: {
|
|
|
|
coef[0].color if coef[0].color is not None else 'blue'
|
|
|
|
}"></span>"""
|
|
|
|
)
|
|
|
|
else:
|
2022-09-08 01:20:04 +02:00
|
|
|
H.append("""<span class="mod_coef_indicator_zero"></span>""")
|
2022-04-10 18:17:57 +02:00
|
|
|
H.append("</a>")
|
2022-01-25 10:45:13 +01:00
|
|
|
H.append("</td>")
|
2021-12-10 15:27:52 +01:00
|
|
|
if mod.module_type in (
|
2021-12-17 23:05:59 +01:00
|
|
|
None, # ne devrait pas être nécessaire car la migration a remplacé les NULLs
|
2021-11-12 22:17:46 +01:00
|
|
|
ModuleType.STANDARD,
|
|
|
|
ModuleType.RESSOURCE,
|
|
|
|
ModuleType.SAE,
|
|
|
|
):
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append('<td class="evals">')
|
2024-02-26 13:55:04 +01:00
|
|
|
nb_evals = etat["nb_evals"]
|
2020-09-26 16:19:37 +02:00
|
|
|
if nb_evals != 0:
|
2024-02-26 13:55:04 +01:00
|
|
|
if etat["nb_evals_blocked"] > 0:
|
2024-02-26 14:14:30 +01:00
|
|
|
blocked_txt = f"""<span class="nb_evals_blocked">{
|
2024-02-26 13:55:04 +01:00
|
|
|
etat["nb_evals_blocked"]} bloquée{'s'
|
|
|
|
if etat["nb_evals_blocked"] > 1 else ''}</span>"""
|
|
|
|
else:
|
|
|
|
blocked_txt = ""
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2023-02-02 10:40:58 +01:00
|
|
|
f"""<a href="{moduleimpl_status_url}"
|
2024-02-04 18:36:11 +01:00
|
|
|
title="les évaluations 'ok' sont celles prises en compte dans les calculs"
|
2023-02-02 10:40:58 +01:00
|
|
|
class="formsemestre_status_link">{nb_evals} prévues,
|
2024-02-26 13:55:04 +01:00
|
|
|
{etat["nb_evals_completes"]} ok {blocked_txt}
|
|
|
|
</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
if etat["nb_evals_en_cours"] > 0:
|
|
|
|
H.append(
|
2023-02-02 10:40:58 +01:00
|
|
|
f""", <span><a class="redlink" href="{moduleimpl_status_url}"
|
|
|
|
title="Il manque des notes">{
|
|
|
|
etat["nb_evals_en_cours"]
|
|
|
|
} en cours</a></span>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-04 18:36:11 +01:00
|
|
|
if etat["attente"]:
|
|
|
|
H.append(
|
|
|
|
f""" <span><a class="redlink" href="{moduleimpl_status_url}"
|
2024-03-18 14:20:34 +01:00
|
|
|
title="Il y a des notes en attente"><span class="evals_attente">{
|
|
|
|
etat["nb_evals_attente"]
|
|
|
|
} en attente</span></a></span>"""
|
2024-02-04 18:36:11 +01:00
|
|
|
)
|
2024-02-21 22:39:12 +01:00
|
|
|
if not mod_is_conforme:
|
|
|
|
H.append(
|
|
|
|
f""" <span><a class="redlink" href="{moduleimpl_status_url}"
|
|
|
|
title="évaluations non conformes">[non conforme]</a></span>"""
|
|
|
|
)
|
2021-12-10 15:27:52 +01:00
|
|
|
elif mod.module_type == ModuleType.MALUS:
|
2020-09-26 16:19:37 +02:00
|
|
|
nb_malus_notes = sum(
|
2024-02-02 15:16:55 +01:00
|
|
|
e["etat"]["nb_notes"] for e in nt.get_mod_evaluation_etat_list(modimpl)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append(
|
2023-02-02 10:40:58 +01:00
|
|
|
f"""<td class="malus">
|
|
|
|
<a href="{moduleimpl_status_url}" class="formsemestre_status_link">malus
|
|
|
|
({nb_malus_notes} notes)</a>
|
2020-09-26 16:19:37 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
else:
|
2021-12-17 23:05:59 +01:00
|
|
|
raise ValueError(f"Invalid module_type {mod.module_type}") # a bug
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H.append("</td></tr>")
|
2021-11-12 22:17:46 +01:00
|
|
|
return "\n".join(H)
|
2022-10-05 23:48:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Expérimental
|
|
|
|
def get_formsemestre_etudids_sans_notes(
|
|
|
|
formsemestre: FormSemestre, res: ResultatsSemestre
|
|
|
|
) -> set[int]:
|
2022-10-06 14:06:02 +02:00
|
|
|
"""Les étudids d'étudiants de ce semestre n'ayant aucune note
|
2022-10-05 23:48:54 +02:00
|
|
|
alors que d'autres en ont.
|
|
|
|
"""
|
2022-10-06 00:19:54 +02:00
|
|
|
# Il y a-t-il des notes déjà saisies ?
|
|
|
|
nb_notes_sem = (
|
|
|
|
NotesNotes.query.join(Evaluation)
|
|
|
|
.join(ModuleImpl)
|
|
|
|
.filter_by(formsemestre_id=formsemestre.id)
|
|
|
|
.count()
|
|
|
|
)
|
|
|
|
if not nb_notes_sem:
|
2023-01-05 13:13:09 +01:00
|
|
|
return set()
|
2023-12-15 05:34:11 +01:00
|
|
|
notes_modimpls = [
|
|
|
|
set.intersection(*m_res.evals_etudids_sans_note.values())
|
|
|
|
for m_res in res.modimpls_results.values()
|
|
|
|
if m_res.evals_etudids_sans_note
|
|
|
|
]
|
|
|
|
if not notes_modimpls:
|
|
|
|
return set()
|
|
|
|
etudids_sans_notes = set.intersection(*notes_modimpls)
|
2022-10-05 23:48:54 +02:00
|
|
|
nb_sans_notes = len(etudids_sans_notes)
|
|
|
|
if nb_sans_notes > 0 and nb_sans_notes < len(
|
|
|
|
formsemestre.get_inscrits(include_demdef=False)
|
|
|
|
):
|
|
|
|
return etudids_sans_notes
|
|
|
|
return set()
|
|
|
|
|
|
|
|
|
|
|
|
def formsemestre_warning_etuds_sans_note(
|
|
|
|
formsemestre: FormSemestre, res: ResultatsSemestre
|
|
|
|
) -> str:
|
|
|
|
"""Vérifie si on est dans la situation où certains (mais pas tous) étudiants
|
|
|
|
n'ont aucune note alors que d'autres en ont.
|
|
|
|
Ce cas se produit typiquement quand on inscrit un étudiant en cours de semestre.
|
|
|
|
Il est alors utile de proposer de mettre toutes ses notes à ABS, ATT ou EXC
|
|
|
|
pour éviter de laisser toutes les évaluations "incomplètes".
|
|
|
|
"""
|
|
|
|
etudids_sans_notes = get_formsemestre_etudids_sans_notes(formsemestre, res)
|
|
|
|
if not etudids_sans_notes:
|
|
|
|
return ""
|
|
|
|
nb_sans_notes = len(etudids_sans_notes)
|
|
|
|
if nb_sans_notes < 5:
|
|
|
|
# peu d'étudiants, affiche leurs noms
|
|
|
|
etuds: list[Identite] = sorted(
|
2023-03-20 11:17:38 +01:00
|
|
|
[Identite.get_etud(etudid) for etudid in etudids_sans_notes],
|
2022-10-05 23:48:54 +02:00
|
|
|
key=lambda e: e.sort_key,
|
|
|
|
)
|
|
|
|
noms = ", ".join(
|
|
|
|
[
|
|
|
|
f"""<a href="{
|
2024-01-20 14:49:36 +01:00
|
|
|
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etud.id)
|
2022-10-05 23:48:54 +02:00
|
|
|
}" class="discretelink">{etud.nomprenom}</a>"""
|
|
|
|
for etud in etuds
|
|
|
|
]
|
|
|
|
)
|
|
|
|
msg_etuds = (
|
|
|
|
f"""{noms} n'{"a" if nb_sans_notes == 1 else "ont"} aucune note :"""
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
msg_etuds = f"""{nb_sans_notes} étudiants n'ont aucune note :"""
|
|
|
|
|
2022-10-06 14:06:02 +02:00
|
|
|
return f"""<div class="formsemestre_status_warning">{msg_etuds}
|
2022-10-05 23:48:54 +02:00
|
|
|
<a class="stdlink" href="{url_for(
|
|
|
|
"notes.formsemestre_note_etuds_sans_notes",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
2023-11-11 18:13:18 +01:00
|
|
|
)}">{"lui" if nb_sans_notes == 1 else "leur"}
|
|
|
|
<span title="pour ne pas bloquer les autres étudiants, il est souvent préférable
|
2022-10-05 23:48:54 +02:00
|
|
|
que les nouveaux aient des notes provisoires">affecter des notes</a>.
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-10-06 14:06:02 +02:00
|
|
|
def formsemestre_note_etuds_sans_notes(
|
|
|
|
formsemestre_id: int, code: str = None, etudid: int = None
|
|
|
|
):
|
|
|
|
"""Affichage et saisie des étudiants sans notes
|
|
|
|
|
|
|
|
Si etudid est spécifié, traite un seul étudiant."""
|
2022-10-05 23:48:54 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.filter_by(
|
|
|
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
|
|
|
res: ResultatsSemestre = res_sem.load_formsemestre_results(formsemestre)
|
|
|
|
etudids_sans_notes = get_formsemestre_etudids_sans_notes(formsemestre, res)
|
2022-10-06 14:06:02 +02:00
|
|
|
if etudid:
|
|
|
|
etudids_sans_notes = etudids_sans_notes.intersection({etudid})
|
2022-10-05 23:48:54 +02:00
|
|
|
etuds: list[Identite] = sorted(
|
2023-03-20 11:17:38 +01:00
|
|
|
[Identite.get_etud(eid) for eid in etudids_sans_notes],
|
2022-10-05 23:48:54 +02:00
|
|
|
key=lambda e: e.sort_key,
|
|
|
|
)
|
|
|
|
if request.method == "POST":
|
|
|
|
if not code in ("ATT", "EXC", "ABS"):
|
|
|
|
raise ScoValueError("code invalide: doit être ATT, ABS ou EXC")
|
|
|
|
for etud in etuds:
|
|
|
|
formsemestre.etud_set_all_missing_notes(etud, code)
|
|
|
|
flash(f"Notes de {len(etuds)} étudiants affectées à {code}")
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
)
|
|
|
|
)
|
2022-10-06 14:06:02 +02:00
|
|
|
if not etuds:
|
|
|
|
if etudid is None:
|
|
|
|
message = """<h3>aucun étudiant sans notes</h3>"""
|
|
|
|
else:
|
|
|
|
flash(
|
2023-03-20 11:17:38 +01:00
|
|
|
f"""{Identite.get_etud(etudid).nomprenom}
|
2022-10-06 14:06:02 +02:00
|
|
|
a déjà des notes"""
|
|
|
|
)
|
|
|
|
return redirect(
|
2024-01-20 14:49:36 +01:00
|
|
|
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
2022-10-06 14:06:02 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
noms = "</li><li>".join(
|
|
|
|
[
|
|
|
|
f"""<a href="{
|
2024-01-20 14:49:36 +01:00
|
|
|
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etud.id)
|
2022-10-05 23:48:54 +02:00
|
|
|
}" class="discretelink">{etud.nomprenom}</a>"""
|
2022-10-06 14:06:02 +02:00
|
|
|
for etud in etuds
|
|
|
|
]
|
|
|
|
)
|
|
|
|
message = f"""
|
|
|
|
<h3>Étudiants sans notes:</h3>
|
|
|
|
<ul>
|
|
|
|
<li>{noms}</li>
|
|
|
|
</ul>
|
|
|
|
"""
|
|
|
|
|
2022-10-05 23:48:54 +02:00
|
|
|
return f"""
|
|
|
|
{html_sco_header.sco_header(
|
|
|
|
page_title=f"{formsemestre.sem_modalite()} {formsemestre.titre_annee()}"
|
|
|
|
)}
|
|
|
|
<div class="formsemestre_status">
|
|
|
|
{formsemestre_status_head(
|
|
|
|
formsemestre_id=formsemestre_id, page_title="Étudiants sans notes"
|
|
|
|
)}
|
|
|
|
</div>
|
2022-10-06 14:06:02 +02:00
|
|
|
{message}
|
2022-10-05 23:48:54 +02:00
|
|
|
|
2024-03-24 11:23:40 +01:00
|
|
|
<style>
|
|
|
|
.sco-std-form select, .sco-std-form input[type="submit"] {{
|
|
|
|
height: 24px;
|
|
|
|
}}
|
|
|
|
</style>
|
|
|
|
<form class="sco-std-form" method="post">
|
2022-10-05 23:48:54 +02:00
|
|
|
<input type="hidden" name="formsemestre_id" value="{formsemestre.id}">
|
2022-10-06 14:06:02 +02:00
|
|
|
<input type="hidden" name="etudid" value="{etudid or ""}">
|
|
|
|
|
|
|
|
Mettre toutes les notes de {"ces étudiants" if len(etuds)> 1 else "cet étudiant"}
|
|
|
|
à :
|
2022-10-05 23:48:54 +02:00
|
|
|
<select name="code">
|
|
|
|
<option value="ABS">ABS (absent, compte zéro)</option>
|
|
|
|
<option value="ATT" selected>ATT (en attente)</option>
|
|
|
|
<option value="EXC">EXC (neutralisée)</option>
|
|
|
|
</select>
|
2024-03-24 11:23:40 +01:00
|
|
|
<input type="submit" value="Enregistrer">
|
2022-10-05 23:48:54 +02:00
|
|
|
</form>
|
|
|
|
{html_sco_header.sco_footer()}
|
|
|
|
"""
|