2020-09-26 16:19:37 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# Gestion scolarite IUT
|
|
|
|
#
|
2022-01-01 14:49:42 +01:00
|
|
|
# Copyright (c) 1999 - 2022 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
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""Tableau de bord semestre
|
|
|
|
"""
|
|
|
|
|
2022-04-19 23:52:52 +02:00
|
|
|
import datetime
|
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-03-07 21:49:11 +01:00
|
|
|
from flask import render_template, url_for
|
2021-07-29 16:31:15 +02:00
|
|
|
from flask_login import current_user
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-08-29 19:57:32 +02:00
|
|
|
from app import log
|
2022-01-08 18:06:00 +01:00
|
|
|
from app.comp import res_sem
|
2022-03-27 22:25:00 +02:00
|
|
|
from app.comp.res_compat import NotesTableCompat
|
2021-12-10 15:27:52 +01:00
|
|
|
from app.models import Module
|
2022-01-07 15:11:24 +01:00
|
|
|
from app.models.formsemestre import FormSemestre
|
2021-06-19 23:21:37 +02:00
|
|
|
import app.scodoc.sco_utils as scu
|
2021-11-12 22:17:46 +01:00
|
|
|
from app.scodoc.sco_utils import ModuleType
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
2022-09-18 16:53:00 +02:00
|
|
|
from app.scodoc.sco_exceptions import (
|
|
|
|
ScoValueError,
|
|
|
|
ScoInvalidDateError,
|
|
|
|
ScoInvalidIdType,
|
|
|
|
)
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import html_sco_header
|
|
|
|
from app.scodoc import htmlutils
|
|
|
|
from app.scodoc import sco_abs
|
|
|
|
from app.scodoc import sco_archives
|
|
|
|
from app.scodoc import sco_bulletins
|
|
|
|
from app.scodoc import sco_codes_parcours
|
|
|
|
from app.scodoc import sco_compute_moy
|
|
|
|
from app.scodoc import sco_edit_ue
|
|
|
|
from app.scodoc import sco_evaluations
|
2021-11-12 22:17:46 +01:00
|
|
|
from app.scodoc import sco_evaluation_db
|
2021-06-19 23:21:37 +02:00
|
|
|
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_moduleimpl
|
|
|
|
from app.scodoc import sco_permissions_check
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
def _build_menu_stats(formsemestre_id):
|
2021-09-13 19:36:53 +02:00
|
|
|
"Définition du menu 'Statistiques'"
|
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,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Graphe des parcours",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_graph_parcours",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2021-07-25 16:42:47 +02:00
|
|
|
"enabled": True,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Codes des parcours",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_suivi_parcours",
|
|
|
|
"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},
|
2020-09-26 16:19:37 +02:00
|
|
|
"enabled": True,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"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},
|
2022-01-26 23:51:46 +01:00
|
|
|
"enabled": True, # 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-08-30 20:31:05 +02:00
|
|
|
def formsemestre_status_menubar(formsemestre: FormSemestre) -> str:
|
2020-09-26 16:19:37 +02:00
|
|
|
"""HTML to render menubar"""
|
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., ...):
|
|
|
|
has_perm_change_sem = current_user.has_permission(Permission.ScoImplement) or (
|
|
|
|
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",
|
|
|
|
},
|
|
|
|
{
|
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": {
|
2022-08-30 20:31:05 +02:00
|
|
|
"formation_id": formation.id,
|
2021-06-19 23:21:37 +02:00
|
|
|
"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,
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_change_lock",
|
|
|
|
"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": "Vérifier absences aux évaluations",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.formsemestre_check_absences_html",
|
|
|
|
"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},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoImplement),
|
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",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoChangeFormation)
|
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},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoImplement),
|
2020-09-26 16:19:37 +02:00
|
|
|
"helpmsg": "",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
# debug :
|
2021-06-17 00:08:37 +02:00
|
|
|
if current_app.config["ENV"] == "development":
|
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
|
|
|
{
|
|
|
|
"title": "Voir 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},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoEtudInscrit)
|
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},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoEtudInscrit)
|
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},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoEtudInscrit)
|
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},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": current_user.has_permission(Permission.ScoEtudChangeAdr)
|
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": {
|
2021-06-17 00:08:37 +02:00
|
|
|
"format": "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
|
|
|
),
|
|
|
|
},
|
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
|
|
|
},
|
|
|
|
]
|
|
|
|
|
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",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Créer/modifier les 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},
|
2021-06-21 10:17:16 +02:00
|
|
|
"enabled": sco_groups.sco_permissions_check.can_change_groups(
|
2021-07-29 16:31:15 +02:00
|
|
|
formsemestre_id
|
2021-06-21 10:17:16 +02:00
|
|
|
),
|
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 = []
|
2021-01-17 22:31:28 +01:00
|
|
|
enabled = (
|
2021-07-29 16:31:15 +02:00
|
|
|
sco_groups.sco_permissions_check.can_change_groups(formsemestre_id)
|
2021-06-21 10:17:16 +02:00
|
|
|
and partitions
|
2021-01-17 22:31:28 +01:00
|
|
|
)
|
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(
|
2020-09-26 16:19:37 +02:00
|
|
|
{"title": "Modifier les groupes", "submenu": submenu, "enabled": enabled}
|
|
|
|
)
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_groupes.append(
|
2022-07-22 17:37:01 +02:00
|
|
|
{
|
|
|
|
"title": "Expérimental: éditeur de partitions",
|
|
|
|
"endpoint": "scolar.partition_editor",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
|
|
|
"enabled": sco_groups.sco_permissions_check.can_change_groups(
|
|
|
|
formsemestre_id
|
|
|
|
),
|
|
|
|
"helpmsg": "Une spécialité de Mulhouse",
|
|
|
|
},
|
|
|
|
)
|
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": "Saisie des notes",
|
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",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"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": "Générer feuille préparation Jury",
|
2021-06-14 18:08:52 +02:00
|
|
|
"endpoint": "notes.feuille_preparation_jury",
|
|
|
|
"args": {"formsemestre_id": formsemestre_id},
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Saisie des décisions du jury",
|
2022-06-23 06:33:03 +02:00
|
|
|
"endpoint": "notes.formsemestre_saisie_jury",
|
2021-06-14 18:08:52 +02:00
|
|
|
"args": {
|
|
|
|
"formsemestre_id": formsemestre_id,
|
|
|
|
},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
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},
|
2021-07-29 16:31:15 +02:00
|
|
|
"enabled": sco_permissions_check.can_edit_pv(formsemestre_id),
|
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},
|
2021-08-20 10:51:42 +02:00
|
|
|
"enabled": sco_archives.PVArchive.list_obj_archives(formsemestre_id),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2022-08-30 20:31:05 +02:00
|
|
|
menu_stats = _build_menu_stats(formsemestre_id)
|
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)
|
|
|
|
|
|
|
|
|
2021-09-23 08:15:54 +02:00
|
|
|
def retreive_formsemestre_from_request() -> int:
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Cherche si on a de quoi déduire le semestre affiché à partir des
|
2020-10-14 15:28:09 +02:00
|
|
|
arguments de la requête:
|
2020-09-26 16:19:37 +02:00
|
|
|
formsemestre_id ou moduleimpl ou evaluation ou group_id ou partition_id
|
2022-03-07 21:49:11 +01:00
|
|
|
Returns None si pas défini.
|
2020-09-26 16:19:37 +02:00
|
|
|
"""
|
2021-07-29 16:31:15 +02:00
|
|
|
if request.method == "GET":
|
|
|
|
args = request.args
|
|
|
|
elif request.method == "POST":
|
|
|
|
args = request.form
|
|
|
|
else:
|
|
|
|
return None
|
2021-09-27 13:43:11 +02:00
|
|
|
formsemestre_id = None
|
2020-09-26 16:19:37 +02:00
|
|
|
# Search formsemestre
|
2021-07-29 16:31:15 +02:00
|
|
|
group_ids = args.get("group_ids", [])
|
|
|
|
if "formsemestre_id" in args:
|
|
|
|
formsemestre_id = args["formsemestre_id"]
|
2021-08-16 22:41:09 +02:00
|
|
|
elif "moduleimpl_id" in args and args["moduleimpl_id"]:
|
2021-10-15 14:00:51 +02:00
|
|
|
modimpl = sco_moduleimpl.moduleimpl_list(moduleimpl_id=args["moduleimpl_id"])
|
2020-09-26 16:19:37 +02:00
|
|
|
if not modimpl:
|
|
|
|
return None # suppressed ?
|
|
|
|
modimpl = modimpl[0]
|
|
|
|
formsemestre_id = modimpl["formsemestre_id"]
|
2021-07-29 16:31:15 +02:00
|
|
|
elif "evaluation_id" in args:
|
2021-11-12 22:17:46 +01:00
|
|
|
E = sco_evaluation_db.do_evaluation_list(
|
|
|
|
{"evaluation_id": args["evaluation_id"]}
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
if not E:
|
|
|
|
return None # evaluation suppressed ?
|
|
|
|
E = E[0]
|
2021-10-15 14:00:51 +02:00
|
|
|
modimpl = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0]
|
2020-09-26 16:19:37 +02:00
|
|
|
formsemestre_id = modimpl["formsemestre_id"]
|
2021-07-29 16:31:15 +02:00
|
|
|
elif "group_id" in args:
|
2021-08-19 10:28:35 +02:00
|
|
|
group = sco_groups.get_group(args["group_id"])
|
2020-09-26 16:19:37 +02:00
|
|
|
formsemestre_id = group["formsemestre_id"]
|
|
|
|
elif group_ids:
|
|
|
|
if group_ids:
|
2021-07-11 22:32:01 +02:00
|
|
|
if isinstance(group_ids, str):
|
2020-09-26 16:19:37 +02:00
|
|
|
group_id = group_ids
|
|
|
|
else:
|
|
|
|
# prend le semestre du 1er groupe de la liste:
|
|
|
|
group_id = group_ids[0]
|
2021-08-19 10:28:35 +02:00
|
|
|
group = sco_groups.get_group(group_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
formsemestre_id = group["formsemestre_id"]
|
2021-07-29 16:31:15 +02:00
|
|
|
elif "partition_id" in args:
|
2021-08-19 10:28:35 +02:00
|
|
|
partition = sco_groups.get_partition(args["partition_id"])
|
2020-09-26 16:19:37 +02:00
|
|
|
formsemestre_id = partition["formsemestre_id"]
|
2021-09-27 13:43:11 +02:00
|
|
|
|
|
|
|
if not formsemestre_id:
|
2020-09-26 16:19:37 +02:00
|
|
|
return None # no current formsemestre
|
|
|
|
|
2021-09-23 08:15:54 +02:00
|
|
|
return int(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
# 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)
|
2021-09-27 10:20:10 +02:00
|
|
|
Cherche dans la requete si un semestre est défini (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 ""
|
2022-06-09 07:39:58 +02:00
|
|
|
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2022-03-07 21:49:11 +01:00
|
|
|
h = render_template(
|
|
|
|
"formsemestre_page_title.html",
|
|
|
|
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
|
|
|
|
|
|
|
return h
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2021-07-29 16:31:15 +02:00
|
|
|
def fill_formsemestre(sem):
|
2020-10-14 15:28:09 +02:00
|
|
|
"""Add some useful fields to help display formsemestres"""
|
2022-08-30 20:31:05 +02:00
|
|
|
sem["notes_url"] = scu.NotesURL()
|
2020-09-26 16:19:37 +02:00
|
|
|
formsemestre_id = sem["formsemestre_id"]
|
2021-08-10 12:57:38 +02:00
|
|
|
if not sem["etat"]:
|
2020-10-14 15:28:09 +02:00
|
|
|
sem[
|
|
|
|
"locklink"
|
2022-08-30 20:31:05 +02:00
|
|
|
] = f"""<a href="{url_for('notes.formsemestre_change_lock',
|
|
|
|
scodoc_dept=g.scodoc_dept,formsemestre_id=formsemestre_id )
|
|
|
|
}">{scu.icontag("lock_img", border="0", title="Semestre verrouillé")}</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
sem["locklink"] = ""
|
2021-07-28 17:03:54 +02:00
|
|
|
if sco_preferences.get_preference("bul_display_publication", formsemestre_id):
|
2021-08-11 00:36:07 +02:00
|
|
|
if sem["bul_hide_xml"]:
|
2021-01-17 22:31:28 +01:00
|
|
|
eyeicon = scu.icontag("hide_img", border="0", title="Bulletins NON publiés")
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2021-01-17 22:31:28 +01:00
|
|
|
eyeicon = scu.icontag("eye_img", border="0", title="Bulletins publiés")
|
2022-08-30 20:31:05 +02:00
|
|
|
sem[
|
|
|
|
"eyelink"
|
|
|
|
] = f"""<a href="{
|
|
|
|
url_for('notes.formsemestre_change_publication_bul',
|
|
|
|
scodoc_dept=g.scodoc_dept,formsemestre_id=formsemestre_id)
|
|
|
|
}">{eyeicon}</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
sem["eyelink"] = ""
|
2021-08-19 10:28:35 +02:00
|
|
|
F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
2020-09-26 16:19:37 +02:00
|
|
|
sem["formation"] = F
|
|
|
|
parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"])
|
|
|
|
if sem["semestre_id"] != -1:
|
2022-08-30 20:31:05 +02:00
|
|
|
sem["num_sem"] = f""", {parcours.SESSION_NAME} {sem["semestre_id"]}"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
sem["num_sem"] = "" # formation sans semestres
|
|
|
|
if sem["modalite"]:
|
2022-08-30 20:31:05 +02:00
|
|
|
sem["modalitestr"] = f""" en {sem["modalite"]}"""
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
sem["modalitestr"] = ""
|
|
|
|
|
|
|
|
sem["etape_apo_str"] = "Code étape Apogée: " + (
|
|
|
|
sco_formsemestre.formsemestre_etape_apo_str(sem) or "Pas de code étape"
|
|
|
|
)
|
|
|
|
|
2021-06-17 00:08:37 +02:00
|
|
|
inscrits = sco_formsemestre_inscriptions.do_formsemestre_inscription_list(
|
2021-08-19 10:28:35 +02:00
|
|
|
args={"formsemestre_id": formsemestre_id}
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
sem["nbinscrits"] = len(inscrits)
|
|
|
|
uresps = [
|
2021-07-03 23:35:32 +02:00
|
|
|
sco_users.user_info(responsable_id) for responsable_id in sem["responsables"]
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
|
|
|
sem["resp"] = ", ".join([u["prenomnom"] for u in uresps])
|
|
|
|
sem["nomcomplet"] = ", ".join([u["nomcomplet"] for u in uresps])
|
|
|
|
|
|
|
|
|
|
|
|
# Description du semestre sous forme de table exportable
|
2022-05-22 07:02:01 +02:00
|
|
|
def formsemestre_description_table(
|
|
|
|
formsemestre_id, with_evals=False, with_parcours=False
|
|
|
|
):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Description du semestre sous forme de table exportable
|
|
|
|
Liste des modules et de leurs coefficients
|
|
|
|
"""
|
2022-02-13 23:53:11 +01:00
|
|
|
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
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)
|
2022-02-21 18:51:45 +01:00
|
|
|
F = sco_formations.formation_list(args={"formation_id": formsemestre.formation_id})[
|
|
|
|
0
|
|
|
|
]
|
2020-09-26 16:19:37 +02:00
|
|
|
parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"])
|
2021-12-12 12:32:21 +01:00
|
|
|
Mlist = sco_moduleimpl.moduleimpl_withmodule_list(
|
|
|
|
formsemestre_id=formsemestre_id, sort_by_ue=True
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
R = []
|
|
|
|
sum_coef = 0
|
|
|
|
sum_ects = 0
|
|
|
|
last_ue_id = None
|
|
|
|
for M in Mlist:
|
|
|
|
# Ligne UE avec ECTS:
|
|
|
|
ue = M["ue"]
|
|
|
|
if ue["ue_id"] != last_ue_id:
|
|
|
|
last_ue_id = ue["ue_id"]
|
|
|
|
if ue["ects"] is None:
|
|
|
|
ects_str = "-"
|
|
|
|
else:
|
|
|
|
sum_ects += ue["ects"]
|
|
|
|
ects_str = ue["ects"]
|
|
|
|
ue_info = {
|
|
|
|
"UE": ue["acronyme"],
|
|
|
|
"ects": ects_str,
|
|
|
|
"Module": ue["titre"],
|
|
|
|
"_css_row_class": "table_row_ue",
|
|
|
|
}
|
|
|
|
if use_ue_coefs:
|
|
|
|
ue_info["Coef."] = ue["coefficient"]
|
|
|
|
ue_info["Coef._class"] = "ue_coef"
|
|
|
|
R.append(ue_info)
|
|
|
|
|
2022-05-22 07:02:01 +02:00
|
|
|
mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list(
|
2021-08-20 01:09:55 +02:00
|
|
|
moduleimpl_id=M["moduleimpl_id"]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2020-12-24 01:00:41 +01:00
|
|
|
enseignants = ", ".join(
|
2021-09-27 10:20:10 +02:00
|
|
|
[sco_users.user_info(m["ens_id"])["nomprenom"] for m in M["ens"]]
|
2020-12-24 01:00:41 +01:00
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
l = {
|
|
|
|
"UE": M["ue"]["acronyme"],
|
2022-02-14 10:05:55 +01:00
|
|
|
"Code": M["module"]["code"] or "",
|
2020-09-26 16:19:37 +02:00
|
|
|
"Module": M["module"]["abbrev"] or M["module"]["titre"],
|
|
|
|
"_Module_class": "scotext",
|
2022-05-22 07:02:01 +02:00
|
|
|
"Inscrits": len(mod_inscrits),
|
2021-07-03 23:35:32 +02:00
|
|
|
"Responsable": sco_users.user_info(M["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",
|
2020-09-26 16:19:37 +02:00
|
|
|
"Coef.": M["module"]["coefficient"],
|
|
|
|
# '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,
|
|
|
|
moduleimpl_id=M["moduleimpl_id"],
|
|
|
|
),
|
|
|
|
"_Code_target": url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=M["moduleimpl_id"],
|
|
|
|
),
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
if M["module"]["coefficient"]:
|
|
|
|
sum_coef += M["module"]["coefficient"]
|
|
|
|
|
2022-05-22 07:02:01 +02:00
|
|
|
if with_parcours:
|
|
|
|
module = Module.query.get(M["module_id"])
|
|
|
|
l["parcours"] = ", ".join(sorted([pa.code for pa in module.parcours]))
|
|
|
|
|
|
|
|
R.append(l)
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
if with_evals:
|
|
|
|
# Ajoute lignes pour evaluations
|
|
|
|
evals = nt.get_mod_evaluation_etat_list(M["moduleimpl_id"])
|
|
|
|
evals.reverse() # ordre chronologique
|
|
|
|
# Ajoute etat:
|
|
|
|
for e in evals:
|
|
|
|
# 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;"'
|
|
|
|
R += evals
|
|
|
|
|
|
|
|
sums = {"_css_row_class": "moyenne sortbottom", "ects": sum_ects, "Coef.": sum_coef}
|
|
|
|
R.append(sums)
|
2022-05-22 07:02:01 +02:00
|
|
|
columns_ids = ["UE", "Code", "Module"]
|
|
|
|
if with_parcours:
|
|
|
|
columns_ids += ["parcours"]
|
|
|
|
columns_ids += ["Coef."]
|
2021-07-28 17:03:54 +02:00
|
|
|
if sco_preferences.get_preference("bul_show_ects", formsemestre_id):
|
2020-09-26 16:19:37 +02:00
|
|
|
columns_ids += ["ects"]
|
2020-12-24 01:00:41 +01:00
|
|
|
columns_ids += ["Inscrits", "Responsable", "Enseignants"]
|
2020-09-26 16:19:37 +02:00
|
|
|
if with_evals:
|
|
|
|
columns_ids += [
|
|
|
|
"jour",
|
|
|
|
"description",
|
|
|
|
"coefficient",
|
|
|
|
"evalcomplete_str",
|
|
|
|
"publish_incomplete_str",
|
|
|
|
]
|
|
|
|
|
|
|
|
titles = {title: title for title in columns_ids}
|
|
|
|
|
|
|
|
titles["ects"] = "ECTS"
|
|
|
|
titles["jour"] = "Evaluation"
|
|
|
|
titles["description"] = ""
|
|
|
|
titles["coefficient"] = "Coef. éval."
|
|
|
|
titles["evalcomplete_str"] = "Complète"
|
2022-05-22 07:02:01 +02:00
|
|
|
titles["parcours"] = "Parcours"
|
2020-09-26 16:19:37 +02:00
|
|
|
titles["publish_incomplete_str"] = "Toujours Utilisée"
|
2022-02-21 18:51:45 +01:00
|
|
|
title = "%s %s" % (parcours.SESSION_NAME.capitalize(), formsemestre.titre_mois())
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
return GenTable(
|
|
|
|
columns_ids=columns_ids,
|
|
|
|
rows=R,
|
|
|
|
titles=titles,
|
2021-08-21 17:07:44 +02:00
|
|
|
origin="Généré par %s le " % sco_version.SCONAME
|
|
|
|
+ scu.timedate_human_repr()
|
|
|
|
+ "",
|
2020-09-26 16:19:37 +02:00
|
|
|
caption=title,
|
|
|
|
html_caption=title,
|
|
|
|
html_class="table_leftalign formsemestre_description",
|
2021-05-11 11:48:32 +02:00
|
|
|
base_url="%s?formsemestre_id=%s&with_evals=%s"
|
2021-09-18 10:10:02 +02:00
|
|
|
% (request.base_url, formsemestre_id, with_evals),
|
2020-09-26 16:19:37 +02:00
|
|
|
page_title=title,
|
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
|
|
|
),
|
|
|
|
pdf_title=title,
|
2021-07-28 17:03:54 +02:00
|
|
|
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-05-22 07:02:01 +02:00
|
|
|
def formsemestre_description(
|
|
|
|
formsemestre_id, format="html", with_evals=False, with_parcours=False
|
|
|
|
):
|
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>
|
|
|
|
<input type="checkbox" name="with_evals" value="1" onchange="document.f.submit()"
|
|
|
|
{ "checked" if with_evals else "" }
|
|
|
|
>indiquer les évaluations</input>
|
|
|
|
<input type="checkbox" name="with_parcours" value="1" onchange="document.f.submit()"
|
|
|
|
{ "checked" if with_parcours else "" }
|
|
|
|
>indiquer les parcours BUT</input>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-09-16 00:15:10 +02:00
|
|
|
return tab.make_page(format=format)
|
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
|
2022-09-07 17:40:40 +02:00
|
|
|
def _make_listes_sem(formsemestre: FormSemestre, with_absences=True):
|
2021-06-02 22:40:34 +02:00
|
|
|
# construit l'URL "destination"
|
|
|
|
# (a laquelle on revient apres saisie absences)
|
2021-07-26 16:52:38 +02:00
|
|
|
destination = url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2022-09-07 17:40:40 +02:00
|
|
|
formsemestre_id=formsemestre.id,
|
2021-07-11 22:32:01 +02:00
|
|
|
)
|
2021-06-02 22:40:34 +02:00
|
|
|
#
|
|
|
|
H = []
|
|
|
|
# pas de menu absences si pas autorise:
|
2021-07-29 16:31:15 +02:00
|
|
|
if with_absences and not current_user.has_permission(Permission.ScoAbsChange):
|
2021-06-02 22:40:34 +02:00
|
|
|
with_absences = False
|
|
|
|
|
|
|
|
#
|
|
|
|
H.append(
|
2022-09-07 17:40:40 +02:00
|
|
|
f"""<h3>Listes de {formsemestre.titre}
|
|
|
|
<span class="infostitresem">({formsemestre.mois_debut()} - {formsemestre.mois_fin()})</span></h3>"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
|
|
|
|
2022-04-19 23:52:52 +02:00
|
|
|
weekday = datetime.datetime.today().weekday()
|
2021-06-02 22:40:34 +02:00
|
|
|
try:
|
|
|
|
if with_absences:
|
2022-09-07 17:40:40 +02:00
|
|
|
first_monday = sco_abs.ddmmyyyy(
|
|
|
|
formsemestre.date_debut.strftime("%d/%m/%Y")
|
|
|
|
).prev_monday()
|
2021-07-26 16:52:38 +02:00
|
|
|
form_abs_tmpl = f"""
|
2022-04-08 16:36:56 +02:00
|
|
|
<td>
|
|
|
|
<a href="%(url_etat)s">absences</a>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<form action="{url_for(
|
2021-07-09 10:26:31 +02:00
|
|
|
"absences.SignaleAbsenceGrSemestre", scodoc_dept=g.scodoc_dept
|
2021-07-26 16:52:38 +02:00
|
|
|
)}" method="get">
|
2022-09-07 17:40:40 +02:00
|
|
|
<input type="hidden" name="datefin" value="{
|
|
|
|
formsemestre.date_fin.strftime("%d/%m/%Y")}"/>
|
2021-07-26 16:52:38 +02:00
|
|
|
<input type="hidden" name="group_ids" value="%(group_id)s"/>
|
|
|
|
<input type="hidden" name="destination" value="{destination}"/>
|
2022-04-08 16:36:56 +02:00
|
|
|
<input type="submit" value="Saisir abs des" />
|
2021-07-26 16:52:38 +02:00
|
|
|
<select name="datedebut" class="noprint">
|
|
|
|
"""
|
2021-06-02 22:40:34 +02:00
|
|
|
date = first_monday
|
2022-04-19 23:52:52 +02:00
|
|
|
for idx, jour in enumerate(sco_abs.day_names()):
|
2022-09-07 17:40:40 +02:00
|
|
|
form_abs_tmpl += f"""<option value="{date}" {
|
|
|
|
'selected' if idx == weekday else ''
|
|
|
|
}>{jour}s</option>"""
|
2021-07-09 10:26:31 +02:00
|
|
|
date = date.next_day()
|
2022-04-08 16:36:56 +02:00
|
|
|
form_abs_tmpl += f"""
|
2021-07-26 16:52:38 +02:00
|
|
|
</select>
|
2022-04-08 16:36:56 +02:00
|
|
|
|
|
|
|
<a href="{
|
|
|
|
url_for("absences.choix_semaine", scodoc_dept=g.scodoc_dept)
|
|
|
|
}?group_id=%(group_id)s">saisie par semaine</a>
|
2021-07-26 16:52:38 +02:00
|
|
|
</form></td>
|
|
|
|
"""
|
2021-06-02 22:40:34 +02:00
|
|
|
else:
|
2021-07-26 16:52:38 +02:00
|
|
|
form_abs_tmpl = ""
|
2021-06-02 22:40:34 +02:00
|
|
|
except ScoInvalidDateError: # dates incorrectes dans semestres ?
|
2021-07-26 16:52:38 +02:00
|
|
|
form_abs_tmpl = ""
|
2021-06-02 22:40:34 +02:00
|
|
|
#
|
|
|
|
H.append('<div id="grouplists">')
|
|
|
|
# Genere liste pour chaque partition (categorie de groupes)
|
2022-09-07 17:40:40 +02:00
|
|
|
for partition in sco_groups.get_partitions_list(formsemestre.id):
|
2021-06-02 22:40:34 +02:00
|
|
|
if not partition["partition_name"]:
|
2022-04-08 16:36:56 +02:00
|
|
|
H.append("<h4>Tous les étudiants</h4>")
|
2021-06-02 22:40:34 +02:00
|
|
|
else:
|
|
|
|
H.append("<h4>Groupes de %(partition_name)s</h4>" % partition)
|
2021-08-19 10:28:35 +02:00
|
|
|
groups = sco_groups.get_partition_groups(partition)
|
2021-06-02 22:40:34 +02:00
|
|
|
if groups:
|
|
|
|
H.append("<table>")
|
|
|
|
for group in groups:
|
2021-08-19 10:28:35 +02:00
|
|
|
n_members = len(sco_groups.get_group_members(group["group_id"]))
|
2021-07-26 16:52:38 +02:00
|
|
|
group["url_etat"] = url_for(
|
|
|
|
"absences.EtatAbsencesGr",
|
|
|
|
group_ids=group["group_id"],
|
2022-09-07 17:40:40 +02:00
|
|
|
debut=formsemestre.date_debut.strftime("%d/%m/%Y"),
|
|
|
|
fin=formsemestre.date_fin.strftime("%d/%m/%Y"),
|
2021-07-26 16:52:38 +02:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
)
|
2021-06-02 22:40:34 +02:00
|
|
|
if group["group_name"]:
|
|
|
|
group["label"] = "groupe %(group_name)s" % group
|
|
|
|
else:
|
|
|
|
group["label"] = "liste"
|
|
|
|
H.append(
|
2021-07-26 16:52:38 +02:00
|
|
|
f"""
|
|
|
|
<tr class="listegroupelink">
|
|
|
|
<td>
|
|
|
|
<a href="{
|
|
|
|
url_for("scolar.groups_view",
|
|
|
|
group_ids=group["group_id"],
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
)
|
|
|
|
}">{group["label"]}</a>
|
2021-06-02 22:40:34 +02:00
|
|
|
</td><td>
|
2021-07-26 16:52:38 +02:00
|
|
|
</td>
|
|
|
|
<td>({n_members} étudiants)</td>
|
|
|
|
"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if with_absences:
|
2021-07-26 16:52:38 +02:00
|
|
|
H.append(form_abs_tmpl % group)
|
2021-06-02 22:40:34 +02:00
|
|
|
|
|
|
|
H.append("</tr>")
|
|
|
|
H.append("</table>")
|
|
|
|
else:
|
|
|
|
H.append('<p class="help indent">Aucun groupe dans cette partition')
|
2022-09-07 17:40:40 +02:00
|
|
|
if sco_groups.sco_permissions_check.can_change_groups(formsemestre.id):
|
2021-06-02 22:40:34 +02:00
|
|
|
H.append(
|
2021-10-04 22:05:05 +02:00
|
|
|
f""" (<a href="{url_for("scolar.affect_groups",
|
2021-08-16 08:33:12 +02:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
partition_id=partition["partition_id"])
|
|
|
|
}" class="stdlink">créer</a>)"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
|
|
|
H.append("</p>")
|
2022-09-07 17:40:40 +02:00
|
|
|
if sco_groups.sco_permissions_check.can_change_groups(formsemestre.id):
|
2021-06-02 22:40:34 +02:00
|
|
|
H.append(
|
2022-09-07 17:40:40 +02:00
|
|
|
f"""<h4><a
|
2021-07-26 16:52:38 +02:00
|
|
|
href="{
|
2022-09-07 17:40:40 +02:00
|
|
|
url_for("scolar.edit_partition_form",
|
|
|
|
formsemestre_id=formsemestre.id,
|
2021-07-26 16:52:38 +02:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
)
|
|
|
|
}">Ajouter une partition</a></h4>"""
|
2021-06-02 22:40:34 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H.append("</div>")
|
|
|
|
return "\n".join(H)
|
|
|
|
|
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
def html_expr_diagnostic(diagnostics):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Affiche messages d'erreur des formules utilisateurs"""
|
|
|
|
H = []
|
|
|
|
H.append('<div class="ue_warning">Erreur dans des formules utilisateurs:<ul>')
|
|
|
|
last_id, last_msg = None, None
|
|
|
|
for diag in diagnostics:
|
|
|
|
if "moduleimpl_id" in diag:
|
2021-10-15 14:00:51 +02:00
|
|
|
mod = sco_moduleimpl.moduleimpl_withmodule_list(
|
2021-08-20 01:09:55 +02:00
|
|
|
moduleimpl_id=diag["moduleimpl_id"]
|
2020-09-26 16:19:37 +02:00
|
|
|
)[0]
|
|
|
|
H.append(
|
|
|
|
'<li>module <a href="moduleimpl_status?moduleimpl_id=%s">%s</a>: %s</li>'
|
|
|
|
% (
|
|
|
|
diag["moduleimpl_id"],
|
|
|
|
mod["module"]["abbrev"] or mod["module"]["code"] or "?",
|
|
|
|
diag["msg"],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
if diag["ue_id"] != last_id or diag["msg"] != last_msg:
|
2021-10-17 23:19:26 +02:00
|
|
|
ue = sco_edit_ue.ue_list({"ue_id": diag["ue_id"]})[0]
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
|
|
|
'<li>UE "%s": %s</li>'
|
|
|
|
% (ue["acronyme"] or ue["titre"] or "?", diag["msg"])
|
|
|
|
)
|
|
|
|
last_id, last_msg = diag["ue_id"], diag["msg"]
|
|
|
|
|
|
|
|
H.append("</ul></div>")
|
|
|
|
return "".join(H)
|
|
|
|
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_status_head(formsemestre_id=None, page_title=None):
|
2020-10-14 15:28:09 +02:00
|
|
|
"""En-tête HTML des pages "semestre" """
|
2022-01-07 15:11:24 +01:00
|
|
|
sem = FormSemestre.query.get(formsemestre_id)
|
|
|
|
if not sem:
|
|
|
|
raise ScoValueError("Semestre inexistant (il a peut être été supprimé ?)")
|
|
|
|
formation = sem.formation
|
|
|
|
parcours = formation.get_parcours()
|
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>
|
2022-01-07 15:11:24 +01:00
|
|
|
<a href="{url_for('notes.ue_table',
|
|
|
|
scodoc_dept=g.scodoc_dept, formation_id=sem.formation.id)}"
|
|
|
|
class="discretelink" title="Formation {
|
|
|
|
formation.acronyme}, v{formation.version}">{formation.titre}</a>
|
|
|
|
""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2022-01-07 15:11:24 +01:00
|
|
|
if sem.semestre_id >= 0:
|
|
|
|
H.append(", %s %s" % (parcours.SESSION_NAME, sem.semestre_id))
|
|
|
|
if sem.modalite:
|
|
|
|
H.append(f" en {sem.modalite}")
|
|
|
|
if sem.etapes:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-01-07 15:11:24 +01:00
|
|
|
f""" (étape <b><tt>{
|
|
|
|
sem.etapes_apo_str() or "-"
|
|
|
|
}</tt></b>)"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append("</td></tr>")
|
2022-05-22 03:26:39 +02:00
|
|
|
if sem.parcours:
|
|
|
|
H.append(
|
|
|
|
f"""
|
|
|
|
<tr><td class="fichetitre2">Parcours: </td>
|
|
|
|
<td style="color: blue;">{', '.join(parcours.code for parcours in sem.parcours)}</td>
|
|
|
|
</tr>
|
|
|
|
"""
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-07-29 10:19:00 +02:00
|
|
|
evals = sco_evaluations.do_evaluation_etat_in_sem(formsemestre_id)
|
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>")
|
|
|
|
if evals["attente"]:
|
|
|
|
H.append(
|
|
|
|
"""<tr><td class="fichetitre2"></td><td class="redboldtext">
|
|
|
|
Il y a des notes en attente ! Le classement des étudiants n'a qu'une valeur indicative.
|
|
|
|
</td></tr>"""
|
|
|
|
)
|
|
|
|
H.append("</table>")
|
2021-09-16 22:24:08 +02:00
|
|
|
sem_warning = ""
|
2022-01-07 15:11:24 +01:00
|
|
|
if sem.bul_hide_xml:
|
2021-09-16 22:24:08 +02:00
|
|
|
sem_warning += "Bulletins non publiés sur le portail. "
|
2022-01-07 15:11:24 +01:00
|
|
|
if sem.block_moyennes:
|
2021-09-16 22:24:08 +02:00
|
|
|
sem_warning += "Calcul des moyennes bloqué !"
|
|
|
|
if sem_warning:
|
|
|
|
H.append('<p class="fontorange"><em>' + sem_warning + "</em></p>")
|
2022-01-07 15:11:24 +01:00
|
|
|
if sem.semestre_id >= 0 and not sem.est_sur_une_annee():
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
|
|
|
'<p class="fontorange"><em>Attention: ce semestre couvre plusieurs années scolaires !</em></p>'
|
|
|
|
)
|
|
|
|
|
|
|
|
return "".join(H)
|
|
|
|
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_status(formsemestre_id=None):
|
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)
|
2021-11-12 22:17:46 +01:00
|
|
|
modimpls = sco_moduleimpl.moduleimpl_withmodule_list(
|
|
|
|
formsemestre_id=formsemestre_id
|
|
|
|
)
|
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:
|
|
|
|
mails_enseignants.add(sco_users.user_info(modimpl["responsable_id"])["email"])
|
|
|
|
mails_enseignants |= set(
|
|
|
|
[sco_users.user_info(m["ens_id"])["email"] for m in modimpl["ens"]]
|
|
|
|
)
|
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)
|
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
|
|
|
),
|
2022-09-07 17:40:40 +02:00
|
|
|
"""<p><b style="font-size: 130%">Tableau de bord: </b>
|
|
|
|
<span class="help">cliquez sur un module pour saisir des notes</span>
|
|
|
|
</p>""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2021-11-12 22:17:46 +01:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
if nt.expr_diagnostics:
|
2021-08-21 00:24:51 +02:00
|
|
|
H.append(html_expr_diagnostic(nt.expr_diagnostics))
|
2021-11-12 22:17:46 +01:00
|
|
|
|
|
|
|
if nt.parcours.APC_SAE:
|
|
|
|
# BUT: tableau ressources puis SAE
|
|
|
|
ressources = [
|
|
|
|
m for m in modimpls if m["module"]["module_type"] == ModuleType.RESSOURCE
|
|
|
|
]
|
|
|
|
saes = [m for m in modimpls if m["module"]["module_type"] == ModuleType.SAE]
|
|
|
|
autres = [
|
|
|
|
m
|
|
|
|
for m in modimpls
|
|
|
|
if m["module"]["module_type"] not in (ModuleType.RESSOURCE, ModuleType.SAE)
|
|
|
|
]
|
|
|
|
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(
|
2021-11-12 22:17:46 +01:00
|
|
|
ressources, nt, formsemestre_id, 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(
|
|
|
|
saes, nt, formsemestre_id, can_edit=can_edit, show_ues=False
|
|
|
|
),
|
|
|
|
]
|
|
|
|
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(
|
|
|
|
autres, nt, formsemestre_id, can_edit=can_edit, show_ues=False
|
|
|
|
),
|
|
|
|
]
|
|
|
|
H += [_TABLEAU_MODULES_FOOT, "</div>"]
|
|
|
|
else:
|
|
|
|
# formations classiques: groupe par UE
|
|
|
|
H += [
|
|
|
|
"<p>",
|
|
|
|
_TABLEAU_MODULES_HEAD,
|
|
|
|
formsemestre_tableau_modules(
|
|
|
|
modimpls,
|
|
|
|
nt,
|
|
|
|
formsemestre_id,
|
|
|
|
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 += [
|
|
|
|
'<div id="groupes">',
|
2022-09-07 17:40:40 +02:00
|
|
|
_make_listes_sem(formsemestre),
|
2021-11-12 22:17:46 +01:00
|
|
|
"</div>",
|
|
|
|
]
|
|
|
|
# --- 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(
|
|
|
|
'<p><a class="stdlink" href="mailto:?cc=%s">Courrier aux %d enseignants du semestre</a></p>'
|
|
|
|
% (",".join(adrlist), len(adrlist))
|
|
|
|
)
|
|
|
|
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(
|
|
|
|
modimpls, nt, formsemestre_id, can_edit=True, show_ues=True, use_ue_coefs=False
|
|
|
|
) -> str:
|
|
|
|
"Lignes table HTML avec modules du semestre"
|
|
|
|
H = []
|
|
|
|
prev_ue_id = None
|
|
|
|
for modimpl in modimpls:
|
2022-09-08 01:20:04 +02:00
|
|
|
mod: Module = Module.query.get(modimpl["module_id"])
|
2021-12-13 10:20:16 +01:00
|
|
|
mod_descr = "Module " + (mod.titre or "")
|
2021-12-10 15:27:52 +01:00
|
|
|
if mod.is_apc():
|
|
|
|
coef_descr = ", ".join(
|
2022-01-06 22:42:26 +01:00
|
|
|
[f"{ue.acronyme}: {co}" for ue, co in mod.ue_coefs_list()]
|
2021-12-10 15:27:52 +01:00
|
|
|
)
|
|
|
|
if coef_descr:
|
2021-12-12 10:17:02 +01:00
|
|
|
mod_descr += " Coefs: " + coef_descr
|
2021-12-10 15:27:52 +01:00
|
|
|
else:
|
|
|
|
mod_descr += " (pas de coefficients) "
|
|
|
|
else:
|
|
|
|
mod_descr += ", coef. " + str(mod.coefficient)
|
2021-11-12 22:17:46 +01:00
|
|
|
mod_ens = sco_users.user_info(modimpl["responsable_id"])["nomcomplet"]
|
|
|
|
if modimpl["ens"]:
|
|
|
|
mod_ens += " (resp.), " + ", ".join(
|
|
|
|
[sco_users.user_info(e["ens_id"])["nomcomplet"] for e in modimpl["ens"]]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2021-11-12 22:17:46 +01:00
|
|
|
mod_inscrits = sco_moduleimpl.do_moduleimpl_inscription_list(
|
|
|
|
moduleimpl_id=modimpl["moduleimpl_id"]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2021-11-12 22:17:46 +01:00
|
|
|
|
|
|
|
ue = modimpl["ue"]
|
|
|
|
if show_ues and (prev_ue_id != ue["ue_id"]):
|
2020-09-26 16:19:37 +02:00
|
|
|
prev_ue_id = ue["ue_id"]
|
|
|
|
titre = ue["titre"]
|
2021-11-12 22:17:46 +01:00
|
|
|
if use_ue_coefs:
|
2020-09-26 16:19:37 +02:00
|
|
|
titre += " <b>(coef. %s)</b>" % (ue["coefficient"] or 0.0)
|
|
|
|
H.append(
|
2021-11-12 22:17:46 +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>
|
2022-02-01 17:42:43 +01:00
|
|
|
</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(
|
|
|
|
formsemestre_id, ue["ue_id"], html_quote=True
|
|
|
|
)
|
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>
|
|
|
|
<span class="warning">formule inutilisée en 9.2: <a href="{
|
|
|
|
url_for("notes.delete_ue_expr", scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id, ue_id=ue["ue_id"] )
|
|
|
|
}
|
|
|
|
">supprimer</a></span>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H.append("</td></tr>")
|
|
|
|
|
2021-11-12 22:17:46 +01:00
|
|
|
if modimpl["ue"]["type"] != sco_codes_parcours.UE_STANDARD:
|
2020-09-26 16:19:37 +02:00
|
|
|
fontorange = " fontorange" # style css additionnel
|
|
|
|
else:
|
|
|
|
fontorange = ""
|
|
|
|
|
2021-11-12 22:17:46 +01:00
|
|
|
etat = sco_evaluations.do_evaluation_etat_in_mod(nt, modimpl["moduleimpl_id"])
|
2021-12-08 23:43:07 +01:00
|
|
|
# if nt.parcours.APC_SAE:
|
|
|
|
# tbd style si module non conforme
|
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
|
|
|
|
):
|
2022-09-08 01:20:04 +02:00
|
|
|
H.append(f'<tr class="formsemestre_status_green{fontorange}">')
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2022-09-08 01:20:04 +02:00
|
|
|
H.append(f'<tr class="formsemestre_status{fontorange}">')
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H.append(
|
2022-03-20 23:12:30 +01:00
|
|
|
f"""<td class="formsemestre_status_code""><a
|
|
|
|
href="{url_for('notes.moduleimpl_status',
|
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl['moduleimpl_id'])}"
|
|
|
|
title="{mod_descr}" class="stdlink">{mod.code}</a></td>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append(
|
|
|
|
'<td class="scotext"><a href="moduleimpl_status?moduleimpl_id=%s" title="%s" class="formsemestre_status_link">%s</a></td>'
|
2022-07-03 22:45:56 +02:00
|
|
|
% (modimpl["moduleimpl_id"], mod_descr, mod.abbrev or mod.titre or "")
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2021-11-12 22:17:46 +01:00
|
|
|
H.append('<td class="formsemestre_status_inscrits">%s</td>' % len(mod_inscrits))
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
|
|
|
'<td class="resp scotext"><a class="discretelink" href="moduleimpl_status?moduleimpl_id=%s" title="%s">%s</a></td>'
|
|
|
|
% (
|
2021-11-12 22:17:46 +01:00
|
|
|
modimpl["moduleimpl_id"],
|
|
|
|
mod_ens,
|
|
|
|
sco_users.user_info(modimpl["responsable_id"])["prenomnom"],
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
)
|
2022-01-25 10:45:13 +01:00
|
|
|
H.append("<td>")
|
|
|
|
if mod.module_type in (ModuleType.RESSOURCE, ModuleType.SAE):
|
|
|
|
coefs = mod.ue_coefs_list()
|
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">')
|
|
|
|
nb_evals = (
|
|
|
|
etat["nb_evals_completes"]
|
|
|
|
+ etat["nb_evals_en_cours"]
|
|
|
|
+ etat["nb_evals_vides"]
|
|
|
|
)
|
|
|
|
if nb_evals != 0:
|
|
|
|
H.append(
|
|
|
|
'<a href="moduleimpl_status?moduleimpl_id=%s" class="formsemestre_status_link">%s prévues, %s ok</a>'
|
2021-11-12 22:17:46 +01:00
|
|
|
% (modimpl["moduleimpl_id"], nb_evals, etat["nb_evals_completes"])
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
if etat["nb_evals_en_cours"] > 0:
|
|
|
|
H.append(
|
|
|
|
', <span><a class="redlink" href="moduleimpl_status?moduleimpl_id=%s" title="Il manque des notes">%s en cours</a></span>'
|
2021-11-12 22:17:46 +01:00
|
|
|
% (modimpl["moduleimpl_id"], etat["nb_evals_en_cours"])
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
if etat["attente"]:
|
|
|
|
H.append(
|
|
|
|
' <span><a class="redlink" href="moduleimpl_status?moduleimpl_id=%s" title="Il y a des notes en attente">[en attente]</a></span>'
|
2021-11-12 22:17:46 +01:00
|
|
|
% modimpl["moduleimpl_id"]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
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(
|
|
|
|
[
|
|
|
|
e["etat"]["nb_notes"]
|
2021-11-12 22:17:46 +01:00
|
|
|
for e in nt.get_mod_evaluation_etat_list(modimpl["moduleimpl_id"])
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
|
|
|
)
|
|
|
|
H.append(
|
|
|
|
"""<td class="malus">
|
|
|
|
<a href="moduleimpl_status?moduleimpl_id=%s" class="formsemestre_status_link">malus (%d notes)</a>
|
|
|
|
"""
|
2021-11-12 22:17:46 +01:00
|
|
|
% (modimpl["moduleimpl_id"], nb_malus_notes)
|
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)
|