2021-05-31 00:14:15 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# ScoDoc
|
|
|
|
#
|
2023-01-02 13:16:27 +01:00
|
|
|
# Copyright (c) 1999 - 2023 Emmanuel Viennet. All rights reserved.
|
2021-05-31 00:14:15 +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
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""
|
|
|
|
Module notes: issu de ScoDoc7 / ZNotes.py
|
|
|
|
|
|
|
|
Emmanuel Viennet, 2021
|
2021-05-29 18:22:51 +02:00
|
|
|
"""
|
2021-07-09 23:19:30 +02:00
|
|
|
from operator import itemgetter
|
2022-03-07 21:49:11 +01:00
|
|
|
import time
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2021-08-01 10:16:16 +02:00
|
|
|
import flask
|
2023-08-02 00:13:31 +02:00
|
|
|
from flask import flash, redirect, render_template, url_for
|
2022-10-30 16:07:06 +01:00
|
|
|
from flask import g, request
|
2021-08-10 17:12:10 +02:00
|
|
|
from flask_login import current_user
|
2022-02-13 23:53:11 +01:00
|
|
|
|
2022-08-07 19:56:25 +02:00
|
|
|
from app import db
|
|
|
|
from app import models
|
|
|
|
from app.auth.models import User
|
2023-06-23 15:35:52 +02:00
|
|
|
from app.but import (
|
|
|
|
apc_edit_ue,
|
2023-09-07 23:09:39 +02:00
|
|
|
bulletin_but_court, # ne pas enlever: ajoute des routes !
|
2023-06-23 15:35:52 +02:00
|
|
|
cursus_but,
|
|
|
|
jury_edit_manual,
|
|
|
|
jury_but,
|
|
|
|
jury_but_pv,
|
|
|
|
jury_but_validation_auto,
|
|
|
|
jury_but_view,
|
|
|
|
)
|
2022-06-25 02:59:43 +02:00
|
|
|
from app.but.forms import jury_but_forms
|
2023-06-23 15:35:52 +02:00
|
|
|
|
2022-08-07 19:56:25 +02:00
|
|
|
|
2023-06-18 09:37:13 +02:00
|
|
|
from app.comp import jury, res_sem
|
2022-03-27 22:25:00 +02:00
|
|
|
from app.comp.res_compat import NotesTableCompat
|
2023-06-25 11:49:11 +02:00
|
|
|
from app.models import (
|
2023-09-06 08:48:00 +02:00
|
|
|
ApcNiveau,
|
2023-12-15 03:37:55 +01:00
|
|
|
Assiduite,
|
2023-08-29 11:27:24 +02:00
|
|
|
BulAppreciations,
|
2023-09-06 08:48:00 +02:00
|
|
|
DispenseUE,
|
2023-08-22 17:02:00 +02:00
|
|
|
Evaluation,
|
2023-06-25 11:49:11 +02:00
|
|
|
Formation,
|
2023-09-06 08:48:00 +02:00
|
|
|
FormSemestre,
|
|
|
|
FormSemestreInscription,
|
|
|
|
FormSemestreUEComputationExpr,
|
|
|
|
Identite,
|
|
|
|
Module,
|
|
|
|
ModuleImpl,
|
2023-06-25 11:49:11 +02:00
|
|
|
ScolarAutorisationInscription,
|
|
|
|
ScolarNews,
|
|
|
|
Scolog,
|
2023-09-06 08:48:00 +02:00
|
|
|
ScoDocSiteConfig,
|
|
|
|
UniteEns,
|
2023-06-25 11:49:11 +02:00
|
|
|
)
|
2023-02-12 01:13:43 +01:00
|
|
|
from app.scodoc.sco_exceptions import ScoFormationConflict, ScoPermissionDenied
|
2022-08-07 19:56:25 +02:00
|
|
|
from app.views import notes_bp as bp
|
2021-05-29 18:22:51 +02:00
|
|
|
|
|
|
|
from app.decorators import (
|
2021-08-13 00:34:58 +02:00
|
|
|
scodoc,
|
2021-05-29 18:22:51 +02:00
|
|
|
scodoc7func,
|
|
|
|
permission_required,
|
2021-09-09 16:11:05 +02:00
|
|
|
permission_required_compat_scodoc7,
|
2021-05-29 18:22:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
# ---------------
|
|
|
|
|
2022-07-06 00:05:14 +02:00
|
|
|
from app.scodoc import sco_bulletins_json, sco_utils as scu
|
2021-06-02 14:50:41 +02:00
|
|
|
from app.scodoc import notesdb as ndb
|
2021-08-29 19:57:32 +02:00
|
|
|
from app import log, send_scodoc_alarm
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2021-06-02 14:50:41 +02:00
|
|
|
from app.scodoc.scolog import logdb
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2022-02-27 20:12:20 +01:00
|
|
|
from app.scodoc.sco_exceptions import (
|
|
|
|
AccessDenied,
|
|
|
|
ScoValueError,
|
|
|
|
ScoInvalidIdType,
|
|
|
|
)
|
2021-06-15 12:34:33 +02:00
|
|
|
from app.scodoc import html_sco_header
|
2021-09-25 23:56:17 +02:00
|
|
|
from app.pe import pe_view
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_apogee_compare
|
|
|
|
from app.scodoc import sco_archives
|
2023-12-23 13:53:02 +01:00
|
|
|
from app.scodoc import sco_archives_formsemestre
|
2023-08-27 21:49:50 +02:00
|
|
|
from app.scodoc import sco_assiduites
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_bulletins
|
|
|
|
from app.scodoc import sco_bulletins_pdf
|
2021-06-12 22:43:22 +02:00
|
|
|
from app.scodoc import sco_cache
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_cost_formation
|
|
|
|
from app.scodoc import sco_debouche
|
2021-12-10 00:54:57 +01:00
|
|
|
from app.scodoc import sco_edit_apc
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_edit_formation
|
|
|
|
from app.scodoc import sco_edit_matiere
|
|
|
|
from app.scodoc import sco_edit_module
|
|
|
|
from app.scodoc import sco_edit_ue
|
|
|
|
from app.scodoc import sco_etape_apogee_view
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import sco_etud
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_evaluations
|
2021-11-20 17:53:21 +01:00
|
|
|
from app.scodoc import sco_evaluation_check_abs
|
2021-11-12 22:17:46 +01:00
|
|
|
from app.scodoc import sco_evaluation_db
|
|
|
|
from app.scodoc import sco_evaluation_edit
|
2022-04-10 17:38:59 +02:00
|
|
|
from app.scodoc import sco_evaluation_recap
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_export_results
|
|
|
|
from app.scodoc import sco_formations
|
2022-04-20 22:55:40 +02:00
|
|
|
from app.scodoc import sco_formation_recap
|
2023-03-21 21:14:38 +01:00
|
|
|
from app.scodoc import sco_formation_versions
|
2021-06-12 22:43:22 +02:00
|
|
|
from app.scodoc import sco_formsemestre
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_formsemestre_custommenu
|
2021-06-12 22:43:22 +02:00
|
|
|
from app.scodoc import sco_formsemestre_edit
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_formsemestre_exterieurs
|
2021-06-12 22:43:22 +02:00
|
|
|
from app.scodoc import sco_formsemestre_inscriptions
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_formsemestre_status
|
|
|
|
from app.scodoc import sco_formsemestre_validation
|
|
|
|
from app.scodoc import sco_inscr_passage
|
2021-06-12 22:43:22 +02:00
|
|
|
from app.scodoc import sco_liste_notes
|
|
|
|
from app.scodoc import sco_lycee
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_moduleimpl
|
|
|
|
from app.scodoc import sco_moduleimpl_inscriptions
|
|
|
|
from app.scodoc import sco_moduleimpl_status
|
2023-08-22 17:02:00 +02:00
|
|
|
from app.scodoc import sco_permissions_check
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_placement
|
|
|
|
from app.scodoc import sco_poursuite_dut
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import sco_preferences
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_prepajury
|
2023-02-19 15:45:27 +01:00
|
|
|
from app.scodoc import sco_pv_forms
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_recapcomplet
|
|
|
|
from app.scodoc import sco_report
|
2022-09-26 22:54:49 +02:00
|
|
|
from app.scodoc import sco_report_but
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_saisie_notes
|
2021-06-12 22:43:22 +02:00
|
|
|
from app.scodoc import sco_semset
|
2021-06-13 18:29:53 +02:00
|
|
|
from app.scodoc import sco_synchro_etuds
|
|
|
|
from app.scodoc import sco_tag_module
|
|
|
|
from app.scodoc import sco_ue_external
|
|
|
|
from app.scodoc import sco_undo_notes
|
2021-06-26 21:57:54 +02:00
|
|
|
from app.scodoc import sco_users
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.gen_tables import GenTable
|
2023-02-27 17:45:20 +01:00
|
|
|
from app.scodoc.sco_pv_dict import descr_autorisations
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
|
|
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
2021-12-06 21:19:40 +01:00
|
|
|
from app.views import ScoData
|
2021-06-12 22:43:22 +02:00
|
|
|
|
2021-05-29 18:22:51 +02:00
|
|
|
|
2022-02-10 14:34:16 +01:00
|
|
|
def sco_publish(route, function, permission, methods=("GET",)):
|
2021-05-31 00:14:15 +02:00
|
|
|
"""Declare a route for a python function,
|
|
|
|
protected by permission and called following ScoDoc 7 Zope standards.
|
|
|
|
"""
|
2021-06-25 19:24:12 +02:00
|
|
|
return bp.route(route, methods=methods)(
|
2021-08-21 00:24:51 +02:00
|
|
|
scodoc(permission_required(permission)(scodoc7func(function)))
|
2021-06-25 18:25:46 +02:00
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Notes/ methods
|
|
|
|
#
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_status",
|
|
|
|
sco_formsemestre_status.formsemestre_status,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_createwithmodules",
|
|
|
|
sco_formsemestre_edit.formsemestre_createwithmodules,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormSemestre,
|
2021-07-26 16:52:38 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# controle d'acces specifique pour dir. etud:
|
|
|
|
sco_publish(
|
2021-06-02 14:50:41 +02:00
|
|
|
"/formsemestre_editwithmodules",
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_formsemestre_edit.formsemestre_editwithmodules,
|
|
|
|
Permission.ScoView,
|
2021-07-05 23:04:39 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
sco_publish(
|
2021-06-02 14:50:41 +02:00
|
|
|
"/formsemestre_clone",
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_formsemestre_edit.formsemestre_clone,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormSemestre,
|
2021-07-12 23:34:18 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_associate_new_version",
|
2023-03-21 21:14:38 +01:00
|
|
|
sco_formation_versions.formsemestre_associate_new_version,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-07-12 23:34:18 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_delete",
|
|
|
|
sco_formsemestre_edit.formsemestre_delete,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormSemestre,
|
2021-07-13 09:38:31 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_delete2",
|
|
|
|
sco_formsemestre_edit.formsemestre_delete2,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormSemestre,
|
2021-07-13 09:38:31 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2022-10-05 23:48:54 +02:00
|
|
|
sco_publish(
|
2022-10-06 14:06:02 +02:00
|
|
|
"/formsemestre_note_etuds_sans_note",
|
2022-10-05 23:48:54 +02:00
|
|
|
sco_formsemestre_status.formsemestre_note_etuds_sans_notes,
|
|
|
|
Permission.ScoView,
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_recapcomplet",
|
|
|
|
sco_recapcomplet.formsemestre_recapcomplet,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2022-04-10 17:38:59 +02:00
|
|
|
sco_publish(
|
|
|
|
"/evaluations_recap",
|
|
|
|
sco_evaluation_recap.evaluations_recap,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestres_bulletins",
|
|
|
|
sco_recapcomplet.formsemestres_bulletins,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.Observateur,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/moduleimpl_status", sco_moduleimpl_status.moduleimpl_status, Permission.ScoView
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_description",
|
|
|
|
sco_formsemestre_status.formsemestre_description,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-07-29 16:31:15 +02:00
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formation_create",
|
|
|
|
sco_edit_formation.formation_create,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formation_delete",
|
|
|
|
sco_edit_formation.formation_delete,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/formation_edit",
|
|
|
|
sco_edit_formation.formation_edit,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2021-09-09 16:11:05 +02:00
|
|
|
|
|
|
|
|
2023-12-06 20:04:40 +01:00
|
|
|
@bp.route("/formsemestre_bulletinetud")
|
2021-10-26 00:13:42 +02:00
|
|
|
@scodoc
|
2021-10-28 00:52:23 +02:00
|
|
|
@permission_required_compat_scodoc7(Permission.ScoView)
|
2021-09-09 16:11:05 +02:00
|
|
|
@scodoc7func
|
|
|
|
def formsemestre_bulletinetud(
|
|
|
|
etudid=None,
|
|
|
|
formsemestre_id=None,
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt=None,
|
2021-09-09 16:11:05 +02:00
|
|
|
version="long",
|
|
|
|
xml_with_decisions=False,
|
|
|
|
force_publishing=False,
|
|
|
|
prefer_mail_perso=False,
|
2021-10-04 15:09:19 +02:00
|
|
|
code_nip=None,
|
2022-01-10 15:15:26 +01:00
|
|
|
code_ine=None,
|
2021-09-09 16:11:05 +02:00
|
|
|
):
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt = fmt or "html"
|
2023-10-13 22:25:44 +02:00
|
|
|
if version not in scu.BULLETINS_VERSIONS_BUT:
|
2023-12-06 20:40:55 +01:00
|
|
|
raise ScoValueError(
|
|
|
|
"formsemestre_bulletinetud: version de bulletin demandée invalide"
|
|
|
|
)
|
2023-01-14 18:01:54 +01:00
|
|
|
if not isinstance(etudid, int):
|
|
|
|
raise ScoInvalidIdType("formsemestre_bulletinetud: etudid must be an integer !")
|
2022-09-18 16:53:00 +02:00
|
|
|
if formsemestre_id is not None and not isinstance(formsemestre_id, int):
|
2022-07-07 23:34:14 +02:00
|
|
|
raise ScoInvalidIdType(
|
|
|
|
"formsemestre_bulletinetud: formsemestre_id must be an integer !"
|
|
|
|
)
|
2022-07-13 12:03:53 +02:00
|
|
|
formsemestre = FormSemestre.query.filter_by(
|
|
|
|
formsemestre_id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2022-03-14 15:30:51 +01:00
|
|
|
if etudid:
|
2023-03-20 11:17:38 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
2022-03-14 15:30:51 +01:00
|
|
|
elif code_nip:
|
2022-07-13 12:03:53 +02:00
|
|
|
etud = models.Identite.query.filter_by(
|
|
|
|
code_nip=str(code_nip), dept_id=formsemestre.dept_id
|
|
|
|
).first_or_404()
|
2022-03-14 15:30:51 +01:00
|
|
|
elif code_ine:
|
2022-07-13 12:03:53 +02:00
|
|
|
etud = models.Identite.query.filter_by(
|
|
|
|
code_ine=str(code_ine), dept_id=formsemestre.dept_id
|
|
|
|
).first_or_404()
|
2022-03-14 15:30:51 +01:00
|
|
|
else:
|
|
|
|
raise ScoValueError(
|
|
|
|
"Paramètre manquant: spécifier etudid, code_nip ou code_ine"
|
|
|
|
)
|
2023-10-13 22:25:44 +02:00
|
|
|
if version == "butcourt":
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.bulletin_but_pdf" if fmt == "pdf" else "notes.bulletin_but_html",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
etudid=etud.id,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
|
|
|
)
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt == "json":
|
2022-04-26 07:35:06 +02:00
|
|
|
return sco_bulletins.get_formsemestre_bulletin_etud_json(
|
2022-05-04 05:45:46 +02:00
|
|
|
formsemestre, etud, version=version, force_publishing=force_publishing
|
2022-04-26 07:35:06 +02:00
|
|
|
)
|
2023-09-21 10:20:19 +02:00
|
|
|
if formsemestre.formation.is_apc() and fmt == "html":
|
2022-04-26 07:35:06 +02:00
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"but/bulletin.j2",
|
2023-08-29 11:27:24 +02:00
|
|
|
appreciations=BulAppreciations.get_appreciations_list(
|
|
|
|
formsemestre.id, etud.id
|
|
|
|
),
|
2022-04-26 07:35:06 +02:00
|
|
|
bul_url=url_for(
|
|
|
|
"notes.formsemestre_bulletinetud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
2023-08-29 11:27:24 +02:00
|
|
|
etudid=etud.id,
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt="json",
|
2022-04-26 07:35:06 +02:00
|
|
|
force_publishing=1, # pour ScoDoc lui même
|
2022-03-07 21:49:11 +01:00
|
|
|
version=version,
|
2022-04-26 07:35:06 +02:00
|
|
|
),
|
|
|
|
can_edit_appreciations=formsemestre.est_responsable(current_user)
|
2023-09-29 21:17:31 +02:00
|
|
|
or (current_user.has_permission(Permission.EtudInscrit)),
|
2022-04-26 07:35:06 +02:00
|
|
|
etud=etud,
|
|
|
|
formsemestre=formsemestre,
|
|
|
|
inscription_courante=etud.inscription_courante(),
|
|
|
|
inscription_str=etud.inscription_descr()["inscription_str"],
|
|
|
|
is_apc=formsemestre.formation.is_apc(),
|
|
|
|
menu_autres_operations=sco_bulletins.make_menu_autres_operations(
|
|
|
|
formsemestre, etud, "notes.formsemestre_bulletinetud", version
|
|
|
|
),
|
|
|
|
sco=ScoData(etud=etud),
|
|
|
|
scu=scu,
|
|
|
|
time=time,
|
|
|
|
title=f"Bul. {etud.nom} - BUT",
|
|
|
|
version=version,
|
2022-01-10 15:15:26 +01:00
|
|
|
)
|
2022-04-26 07:35:06 +02:00
|
|
|
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt == "oldjson":
|
|
|
|
fmt = "json"
|
2023-03-18 21:56:08 +01:00
|
|
|
|
|
|
|
response = sco_bulletins.formsemestre_bulletinetud(
|
2022-03-14 15:30:51 +01:00
|
|
|
etud,
|
2021-09-09 16:11:05 +02:00
|
|
|
formsemestre_id=formsemestre_id,
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt=fmt,
|
2021-09-09 16:11:05 +02:00
|
|
|
version=version,
|
|
|
|
xml_with_decisions=xml_with_decisions,
|
|
|
|
force_publishing=force_publishing,
|
|
|
|
prefer_mail_perso=prefer_mail_perso,
|
|
|
|
)
|
2023-03-18 21:56:08 +01:00
|
|
|
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt == "pdfmail": # ne renvoie rien dans ce cas (mails envoyés)
|
2022-03-22 19:18:25 +01:00
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_bulletinetud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
etudid=etud.id,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
|
|
|
)
|
2023-03-18 21:56:08 +01:00
|
|
|
return response
|
2021-09-09 16:11:05 +02:00
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_evaluations_cal",
|
|
|
|
sco_evaluations.formsemestre_evaluations_cal,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_evaluations_delai_correction",
|
|
|
|
sco_evaluations.formsemestre_evaluations_delai_correction,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2023-08-22 17:02:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/moduleimpl_evaluation_renumber", methods=["GET", "POST"])
|
|
|
|
@scodoc
|
|
|
|
@permission_required_compat_scodoc7(Permission.ScoView)
|
|
|
|
@scodoc7func
|
|
|
|
def moduleimpl_evaluation_renumber(moduleimpl_id):
|
|
|
|
"Renumérote les évaluations, triant par date"
|
|
|
|
modimpl: ModuleImpl = (
|
|
|
|
ModuleImpl.query.filter_by(id=moduleimpl_id)
|
|
|
|
.join(FormSemestre)
|
|
|
|
.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
.first_or_404()
|
|
|
|
)
|
|
|
|
if not modimpl.can_edit_evaluation(current_user):
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=modimpl.id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
Evaluation.moduleimpl_evaluation_renumber(modimpl)
|
|
|
|
# redirect to moduleimpl page:
|
2023-09-26 23:15:35 +02:00
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=moduleimpl_id,
|
2023-08-22 17:02:00 +02:00
|
|
|
)
|
2023-09-26 23:15:35 +02:00
|
|
|
)
|
2023-08-22 17:02:00 +02:00
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
2023-01-27 14:20:52 +01:00
|
|
|
"/moduleimpl_evaluation_move",
|
|
|
|
sco_evaluation_db.moduleimpl_evaluation_move,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_list_saisies_notes",
|
|
|
|
sco_undo_notes.formsemestre_list_saisies_notes,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-06-25 19:24:12 +02:00
|
|
|
sco_publish(
|
|
|
|
"/ue_create",
|
|
|
|
sco_edit_ue.ue_create,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/ue_delete",
|
|
|
|
sco_edit_ue.ue_delete,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/ue_edit",
|
|
|
|
sco_edit_ue.ue_edit,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
2021-10-21 06:32:03 +02:00
|
|
|
|
|
|
|
|
2022-04-29 08:17:04 +02:00
|
|
|
@bp.route("/set_ue_niveau_competence", methods=["POST"])
|
2022-06-23 13:48:43 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormation)
|
2022-06-23 13:48:43 +02:00
|
|
|
def set_ue_niveau_competence():
|
2022-10-30 16:07:06 +01:00
|
|
|
"""Associe UE et niveau.
|
|
|
|
Si le niveau_id est "", désassocie."""
|
2022-04-29 08:17:04 +02:00
|
|
|
ue_id = request.form.get("ue_id")
|
|
|
|
niveau_id = request.form.get("niveau_id")
|
2022-10-30 16:07:06 +01:00
|
|
|
if niveau_id == "":
|
|
|
|
niveau_id = None
|
|
|
|
ue: UniteEns = UniteEns.query.get_or_404(ue_id)
|
|
|
|
niveau = None if niveau_id is None else ApcNiveau.query.get_or_404(niveau_id)
|
|
|
|
try:
|
|
|
|
ue.set_niveau_competence(niveau)
|
|
|
|
except ScoFormationConflict:
|
|
|
|
return "", 409 # conflict
|
|
|
|
return "", 204
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/get_ue_niveaux_options_html")
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
def get_ue_niveaux_options_html():
|
|
|
|
"""fragment html avec les options du menu de sélection du
|
|
|
|
niveau de compétences associé à une UE
|
|
|
|
"""
|
|
|
|
ue_id = request.args.get("ue_id")
|
2023-04-03 17:46:31 +02:00
|
|
|
if ue_id is None:
|
|
|
|
log("WARNING: get_ue_niveaux_options_html missing ue_id arg")
|
|
|
|
return "???"
|
2022-10-30 16:07:06 +01:00
|
|
|
ue: UniteEns = UniteEns.query.get_or_404(ue_id)
|
|
|
|
return apc_edit_ue.get_ue_niveaux_options_html(ue)
|
2022-04-29 08:17:04 +02:00
|
|
|
|
|
|
|
|
2021-10-21 06:32:03 +02:00
|
|
|
@bp.route("/ue_list") # backward compat
|
2021-10-22 23:09:15 +02:00
|
|
|
@bp.route("/ue_table")
|
2021-10-21 06:32:03 +02:00
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
@scodoc7func
|
2021-11-18 00:24:56 +01:00
|
|
|
def ue_table(formation_id=None, semestre_idx=1, msg=""):
|
|
|
|
return sco_edit_ue.ue_table(
|
|
|
|
formation_id=formation_id, semestre_idx=semestre_idx, msg=msg
|
|
|
|
)
|
2021-10-21 06:32:03 +02:00
|
|
|
|
|
|
|
|
2022-02-15 13:15:56 +01:00
|
|
|
@bp.route("/ue_infos/<int:ue_id>")
|
2021-12-10 00:54:57 +01:00
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
def ue_infos(ue_id):
|
|
|
|
ue = UniteEns.query.get_or_404(ue_id)
|
|
|
|
return sco_edit_apc.html_ue_infos(ue)
|
|
|
|
|
|
|
|
|
2021-10-22 23:09:15 +02:00
|
|
|
@bp.route("/ue_set_internal", methods=["GET", "POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormation)
|
2021-10-22 23:09:15 +02:00
|
|
|
@scodoc7func
|
|
|
|
def ue_set_internal(ue_id):
|
|
|
|
""""""
|
2023-07-11 06:57:38 +02:00
|
|
|
ue = db.session.get(UniteEns, ue_id)
|
2021-10-22 23:09:15 +02:00
|
|
|
if not ue:
|
|
|
|
raise ScoValueError("invalid ue_id")
|
|
|
|
ue.is_external = False
|
|
|
|
db.session.add(ue)
|
|
|
|
db.session.commit()
|
2021-11-03 16:11:58 +01:00
|
|
|
# Invalide les semestres de cette formation
|
2021-12-16 16:27:35 +01:00
|
|
|
ue.formation.invalidate_cached_sems()
|
|
|
|
|
2021-10-22 23:09:15 +02:00
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.ue_table", scodoc_dept=g.scodoc_dept, formation_id=ue.formation_id
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
@bp.route("/ue_sharing_code")
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
@scodoc7func
|
|
|
|
def ue_sharing_code():
|
|
|
|
ue_code = request.args.get("ue_code")
|
|
|
|
ue_id = request.args.get("ue_id")
|
|
|
|
hide_ue_id = request.args.get("hide_ue_id")
|
|
|
|
return sco_edit_ue.ue_sharing_code(
|
|
|
|
ue_code=ue_code,
|
2023-06-29 23:26:14 +02:00
|
|
|
ue_id=None if ((ue_id is None) or ue_id == "") else int(ue_id),
|
|
|
|
hide_ue_id=None
|
|
|
|
if ((hide_ue_id is None) or hide_ue_id == "")
|
|
|
|
else int(hide_ue_id),
|
2023-06-25 11:49:11 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/edit_ue_set_code_apogee",
|
|
|
|
sco_edit_ue.edit_ue_set_code_apogee,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2022-04-21 22:24:09 +02:00
|
|
|
methods=["POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2021-08-11 11:53:20 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_edit_uecoefs",
|
|
|
|
sco_formsemestre_edit.formsemestre_edit_uecoefs,
|
|
|
|
Permission.ScoView,
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
2022-04-21 14:35:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formation_table_recap")
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
@scodoc7func
|
2023-09-21 10:20:19 +02:00
|
|
|
def formation_table_recap(formation_id, fmt="html"):
|
|
|
|
return sco_formation_recap.formation_table_recap(formation_id, fmt=fmt)
|
2022-04-21 14:35:49 +02:00
|
|
|
|
|
|
|
|
2022-04-20 23:47:46 +02:00
|
|
|
sco_publish(
|
|
|
|
"/export_recap_formations_annee_scolaire",
|
|
|
|
sco_formation_recap.export_recap_formations_annee_scolaire,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formation_add_malus_modules",
|
|
|
|
sco_edit_module.formation_add_malus_modules,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/matiere_create",
|
|
|
|
sco_edit_matiere.matiere_create,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/matiere_delete",
|
|
|
|
sco_edit_matiere.matiere_delete,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/matiere_edit",
|
|
|
|
sco_edit_matiere.matiere_edit,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/module_create",
|
|
|
|
sco_edit_module.module_create,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/module_delete",
|
|
|
|
sco_edit_module.module_delete,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/module_edit",
|
|
|
|
sco_edit_module.module_edit,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/edit_module_set_code_apogee",
|
|
|
|
sco_edit_module.edit_module_set_code_apogee,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditFormation,
|
2021-11-17 10:28:51 +01:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2021-10-16 19:20:36 +02:00
|
|
|
sco_publish("/module_list", sco_edit_module.module_table, Permission.ScoView)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish("/module_tag_search", sco_tag_module.module_tag_search, Permission.ScoView)
|
2022-05-02 10:54:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/module_tag_set", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormationTags)
|
2022-05-02 10:54:52 +02:00
|
|
|
def module_tag_set():
|
|
|
|
"""Set tags on module"""
|
|
|
|
module_id = int(request.form.get("module_id"))
|
|
|
|
taglist = request.form.get("taglist")
|
|
|
|
return sco_tag_module.module_tag_set(module_id, taglist)
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2022-11-02 10:41:31 +01:00
|
|
|
@bp.route("/module_clone", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormation)
|
2022-11-02 10:41:31 +01:00
|
|
|
def module_clone():
|
|
|
|
"""Clone existing module"""
|
|
|
|
module_id = int(request.form.get("module_id"))
|
|
|
|
module = Module.query.get_or_404(module_id)
|
|
|
|
module2 = module.clone()
|
|
|
|
db.session.add(module2)
|
|
|
|
db.session.commit()
|
|
|
|
flash(f"Module {module.code} dupliqué")
|
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.ue_table",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
semestre_idx=module.semestre_id,
|
|
|
|
formation_id=module.formation_id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
#
|
|
|
|
@bp.route("/")
|
|
|
|
@bp.route("/index_html")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def index_html():
|
2021-05-31 00:14:15 +02:00
|
|
|
"Page accueil formations"
|
|
|
|
|
2023-09-29 21:17:31 +02:00
|
|
|
editable = current_user.has_permission(Permission.EditFormation)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
H = [
|
2021-07-29 16:31:15 +02:00
|
|
|
html_sco_header.sco_header(page_title="Programmes formations"),
|
2021-05-31 00:14:15 +02:00
|
|
|
"""<h2>Programmes pédagogiques</h2>
|
|
|
|
""",
|
|
|
|
]
|
2021-09-24 20:20:45 +02:00
|
|
|
T = sco_formations.formation_list_table()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
H.append(T.html())
|
|
|
|
|
|
|
|
if editable:
|
|
|
|
H.append(
|
2021-12-04 21:06:32 +01:00
|
|
|
f"""
|
2022-12-24 22:06:22 +01:00
|
|
|
<p class="help">Une "formation" est un programme pédagogique structuré
|
2021-12-04 21:06:32 +01:00
|
|
|
en UE, matières et modules. Chaque semestre se réfère à une formation.
|
2022-12-24 22:06:22 +01:00
|
|
|
La modification d'une formation affecte tous les semestres qui s'y
|
2021-12-04 21:06:32 +01:00
|
|
|
réfèrent.</p>
|
|
|
|
|
|
|
|
<ul>
|
2022-12-24 22:06:22 +01:00
|
|
|
<li><a class="stdlink" href="formation_create" id="link-create-formation">Créer une
|
|
|
|
formation</a>
|
2021-12-04 21:06:32 +01:00
|
|
|
</li>
|
|
|
|
<li><a class="stdlink" href="formation_import_xml_form">Importer une formation (xml)</a>
|
|
|
|
</li>
|
2022-04-20 23:47:46 +02:00
|
|
|
<li><a class="stdlink" href="{
|
|
|
|
url_for("notes.export_recap_formations_annee_scolaire",
|
2022-11-13 14:55:18 +01:00
|
|
|
scodoc_dept=g.scodoc_dept, annee_scolaire=scu.annee_scolaire()-1)
|
2022-04-20 23:47:46 +02:00
|
|
|
}">exporter les formations de l'année scolaire
|
2022-11-13 14:55:18 +01:00
|
|
|
{scu.annee_scolaire()-1} - {scu.annee_scolaire()}
|
2022-04-20 23:47:46 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li><a class="stdlink" href="{
|
|
|
|
url_for("notes.export_recap_formations_annee_scolaire",
|
2022-11-13 14:55:18 +01:00
|
|
|
scodoc_dept=g.scodoc_dept, annee_scolaire=scu.annee_scolaire())
|
2022-12-24 22:06:22 +01:00
|
|
|
}">exporter les formations de l'année scolaire
|
2022-11-13 14:55:18 +01:00
|
|
|
{scu.annee_scolaire()} - {scu.annee_scolaire()+1}
|
2022-04-20 23:47:46 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
2021-12-04 21:06:32 +01:00
|
|
|
</ul>
|
|
|
|
<h3>Référentiels de compétences</h3>
|
|
|
|
<ul>
|
2022-11-22 13:13:16 +01:00
|
|
|
<li><a class="stdlink" href="{
|
|
|
|
url_for('notes.refcomp_table', scodoc_dept=g.scodoc_dept)
|
|
|
|
}">Liste des référentiels chargés</a>
|
2021-12-04 21:06:32 +01:00
|
|
|
</li>
|
|
|
|
</ul>
|
2022-12-24 22:06:22 +01:00
|
|
|
"""
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
2021-07-29 10:19:00 +02:00
|
|
|
H.append(html_sco_header.sco_footer())
|
2021-05-31 00:14:15 +02:00
|
|
|
return "\n".join(H)
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Notes Methods
|
|
|
|
#
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
|
|
|
# --- Formations
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formation_export")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2023-09-21 10:20:19 +02:00
|
|
|
def formation_export(formation_id, export_ids=False, fmt=None, export_codes_apo=True):
|
2021-05-31 00:14:15 +02:00
|
|
|
"Export de la formation au format indiqué (xml ou json)"
|
|
|
|
return sco_formations.formation_export(
|
2023-01-25 15:17:52 +01:00
|
|
|
formation_id,
|
|
|
|
export_ids=export_ids,
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt=fmt,
|
2023-01-25 15:17:52 +01:00
|
|
|
export_codes_apo=export_codes_apo,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/formation_import_xml_form", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormation)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def formation_import_xml_form():
|
2021-05-31 00:14:15 +02:00
|
|
|
"form import d'une formation en XML"
|
|
|
|
tf = TrivialFormulator(
|
2021-09-18 10:10:02 +02:00
|
|
|
request.base_url,
|
2021-09-27 16:42:14 +02:00
|
|
|
scu.get_request_args(),
|
2021-05-31 00:14:15 +02:00
|
|
|
(("xmlfile", {"input_type": "file", "title": "Fichier XML", "size": 30}),),
|
|
|
|
submitlabel="Importer",
|
|
|
|
cancelbutton="Annuler",
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
2022-10-23 23:28:24 +02:00
|
|
|
return f"""
|
|
|
|
{ html_sco_header.sco_header(page_title="Import d'une formation") }
|
|
|
|
<h2>Import d'une formation</h2>
|
|
|
|
<p>Création d'une formation (avec UE, matières, modules)
|
2023-05-14 17:35:06 +02:00
|
|
|
à partir un fichier XML (réservé aux utilisateurs avertis).
|
|
|
|
</p>
|
|
|
|
<p>S'il s'agit d'une formation par compétence (BUT), assurez-vous d'avoir
|
|
|
|
chargé le référentiel de compétences AVANT d'importer le fichier formation
|
|
|
|
(voir <a class="stdlink" href="{
|
|
|
|
url_for("notes.refcomp_table", scodoc_dept=g.scodoc_dept)
|
|
|
|
}">page des référentiels</a>).
|
2022-10-23 23:28:24 +02:00
|
|
|
</p>
|
|
|
|
{ tf[1] }
|
|
|
|
{ html_sco_header.sco_footer() }
|
|
|
|
"""
|
2021-05-31 00:14:15 +02:00
|
|
|
elif tf[0] == -1:
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(scu.NotesURL())
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
2021-06-16 18:18:32 +02:00
|
|
|
formation_id, _, _ = sco_formations.formation_import_xml(
|
2021-08-21 00:24:51 +02:00
|
|
|
tf[2]["xmlfile"].read()
|
2021-06-16 18:18:32 +02:00
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2022-10-23 23:28:24 +02:00
|
|
|
return f"""
|
|
|
|
{ html_sco_header.sco_header(page_title="Import d'une formation") }
|
|
|
|
<h2>Import effectué !</h2>
|
2022-10-24 23:18:45 +02:00
|
|
|
<ul>
|
|
|
|
<li><a class="stdlink" href="{
|
2022-10-23 23:28:24 +02:00
|
|
|
url_for("notes.ue_list", scodoc_dept=g.scodoc_dept, formation_id=formation_id
|
2022-10-24 23:18:45 +02:00
|
|
|
)}">Voir la formation</a>
|
|
|
|
</li>
|
|
|
|
<li><a class="stdlink" href="{
|
|
|
|
url_for("notes.formation_delete", scodoc_dept=g.scodoc_dept, formation_id=formation_id
|
2023-12-06 20:04:40 +01:00
|
|
|
)}">Supprimer cette formation</a>
|
2022-10-24 23:18:45 +02:00
|
|
|
(en cas d'erreur, par exemple pour charger auparavant le référentiel de compétences)
|
|
|
|
</li>
|
|
|
|
</ul>
|
2022-10-23 23:28:24 +02:00
|
|
|
{ html_sco_header.sco_footer() }
|
|
|
|
"""
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2023-02-23 21:19:57 +01:00
|
|
|
# sco_publish(
|
|
|
|
# "/formation_create_new_version",
|
|
|
|
# sco_formations.formation_create_new_version,
|
2023-09-29 21:17:31 +02:00
|
|
|
# Permission.EditFormation,
|
2023-02-23 21:19:57 +01:00
|
|
|
# )
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
# --- UE
|
2021-06-16 18:18:32 +02:00
|
|
|
sco_publish(
|
2021-10-17 23:19:26 +02:00
|
|
|
"/ue_list",
|
|
|
|
sco_edit_ue.ue_list,
|
2021-06-16 18:18:32 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2023-09-29 21:17:31 +02:00
|
|
|
sco_publish("/module_move", sco_edit_formation.module_move, Permission.EditFormation)
|
|
|
|
sco_publish("/ue_move", sco_edit_formation.ue_move, Permission.EditFormation)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2022-11-02 10:41:31 +01:00
|
|
|
@bp.route("/ue_clone", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormation)
|
2022-11-02 10:41:31 +01:00
|
|
|
def ue_clone():
|
|
|
|
"""Clone existing UE"""
|
|
|
|
ue_id = int(request.form.get("ue_id"))
|
|
|
|
ue = UniteEns.query.get_or_404(ue_id)
|
|
|
|
ue2 = ue.clone()
|
|
|
|
db.session.add(ue2)
|
|
|
|
db.session.commit()
|
|
|
|
flash(f"UE {ue.acronyme} dupliquée")
|
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.ue_table",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
semestre_idx=ue.semestre_idx,
|
|
|
|
formation_id=ue.formation_id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
# --- Semestres de formation
|
|
|
|
|
|
|
|
|
2021-09-10 22:03:52 +02:00
|
|
|
@bp.route(
|
|
|
|
"/formsemestre_list", methods=["GET", "POST"]
|
|
|
|
) # pour compat anciens clients PHP
|
2021-10-26 00:13:42 +02:00
|
|
|
@scodoc
|
2021-10-28 00:52:23 +02:00
|
|
|
@permission_required_compat_scodoc7(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-05-31 00:14:15 +02:00
|
|
|
def formsemestre_list(
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt="json",
|
2021-05-31 00:14:15 +02:00
|
|
|
formsemestre_id=None,
|
|
|
|
formation_id=None,
|
|
|
|
etape_apo=None,
|
|
|
|
):
|
|
|
|
"""List formsemestres in given format.
|
|
|
|
kw can specify some conditions: examples:
|
2023-09-21 10:20:19 +02:00
|
|
|
formsemestre_list( fmt='json', formation_id='F777')
|
2021-05-31 00:14:15 +02:00
|
|
|
"""
|
2022-10-24 10:49:34 +02:00
|
|
|
log("Warning: calling deprecated view formsemestre_list")
|
2021-11-27 18:44:32 +01:00
|
|
|
try:
|
|
|
|
formsemestre_id = int(formsemestre_id) if formsemestre_id is not None else None
|
|
|
|
formation_id = int(formation_id) if formation_id is not None else None
|
|
|
|
except ValueError:
|
2022-08-07 19:56:25 +02:00
|
|
|
return scu.json_error(404, "invalid id")
|
2021-05-31 00:14:15 +02:00
|
|
|
args = {}
|
|
|
|
L = locals()
|
|
|
|
for argname in ("formsemestre_id", "formation_id", "etape_apo"):
|
|
|
|
if L[argname] is not None:
|
|
|
|
args[argname] = L[argname]
|
2021-08-19 10:28:35 +02:00
|
|
|
sems = sco_formsemestre.do_formsemestre_list(args=args)
|
2023-09-21 10:20:19 +02:00
|
|
|
return scu.sendResult(sems, name="formsemestre", fmt=fmt)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_edit_options",
|
|
|
|
sco_formsemestre_edit.formsemestre_edit_options,
|
|
|
|
Permission.ScoView,
|
2021-06-28 10:45:00 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2021-09-27 10:20:10 +02:00
|
|
|
|
|
|
|
|
2023-02-21 21:34:38 +01:00
|
|
|
@bp.route("/formsemestre_flip_lock", methods=["GET", "POST"])
|
2021-09-27 10:20:10 +02:00
|
|
|
@scodoc
|
2023-02-21 21:34:38 +01:00
|
|
|
@permission_required(Permission.ScoView) # acces vérifié dans la vue
|
2021-09-27 10:20:10 +02:00
|
|
|
@scodoc7func
|
2023-02-21 21:34:38 +01:00
|
|
|
def formsemestre_flip_lock(formsemestre_id, dialog_confirmed=False):
|
2021-09-27 14:54:52 +02:00
|
|
|
"Changement de l'état de verrouillage du semestre"
|
2023-02-21 21:34:38 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
dest_url = url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
)
|
|
|
|
if not formsemestre.est_chef_or_diretud():
|
|
|
|
raise ScoPermissionDenied("opération non autorisée", dest_url=dest_url)
|
2021-09-27 14:54:52 +02:00
|
|
|
if not dialog_confirmed:
|
2023-02-21 21:34:38 +01:00
|
|
|
msg = "verrouillage" if formsemestre.etat else "déverrouillage"
|
2021-09-27 14:54:52 +02:00
|
|
|
return scu.confirm_dialog(
|
2022-12-24 22:06:22 +01:00
|
|
|
f"<h2>Confirmer le {msg} du semestre ?</h2>",
|
2023-02-23 21:19:57 +01:00
|
|
|
help_msg="""Les notes d'un semestre verrouillé ne peuvent plus être modifiées.
|
2021-09-27 14:54:52 +02:00
|
|
|
Un semestre verrouillé peut cependant être déverrouillé facilement à tout moment
|
|
|
|
(par son responsable ou un administrateur).
|
2022-10-02 23:43:29 +02:00
|
|
|
<br>
|
2021-09-27 14:54:52 +02:00
|
|
|
Le programme d'une formation qui a un semestre verrouillé ne peut plus être modifié.
|
|
|
|
""",
|
|
|
|
dest_url="",
|
2023-02-21 21:34:38 +01:00
|
|
|
cancel_url=dest_url,
|
2021-09-27 14:54:52 +02:00
|
|
|
parameters={"formsemestre_id": formsemestre_id},
|
|
|
|
)
|
|
|
|
|
2023-02-21 21:34:38 +01:00
|
|
|
formsemestre.flip_lock()
|
|
|
|
db.session.commit()
|
2021-09-27 14:54:52 +02:00
|
|
|
|
2023-02-21 21:34:38 +01:00
|
|
|
return flask.redirect(dest_url)
|
2021-09-27 10:20:10 +02:00
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_change_publication_bul",
|
|
|
|
sco_formsemestre_edit.formsemestre_change_publication_bul,
|
|
|
|
Permission.ScoView,
|
2021-08-11 00:36:07 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/view_formsemestre_by_etape",
|
|
|
|
sco_formsemestre.view_formsemestre_by_etape,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/formsemestre_custommenu_edit", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_custommenu_edit(formsemestre_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"Dialogue modif menu"
|
|
|
|
# accessible à tous !
|
2021-09-27 10:20:10 +02:00
|
|
|
return sco_formsemestre_custommenu.formsemestre_custommenu_edit(formsemestre_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
# --- dialogue modif enseignants/moduleimpl
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/edit_enseignants_form", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def edit_enseignants_form(moduleimpl_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"modif liste enseignants/moduleimpl"
|
2021-08-22 13:24:36 +02:00
|
|
|
M, sem = sco_moduleimpl.can_change_ens(moduleimpl_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
# --
|
2021-06-13 18:29:53 +02:00
|
|
|
header = html_sco_header.html_sem_header(
|
2021-05-31 00:14:15 +02:00
|
|
|
'Enseignants du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
|
|
|
|
% (moduleimpl_id, M["module"]["titre"]),
|
|
|
|
page_title="Enseignants du module %s" % M["module"]["titre"],
|
|
|
|
javascripts=["libjs/AutoSuggest.js"],
|
|
|
|
cssstyles=["css/autosuggest_inquisitor.css"],
|
|
|
|
bodyOnLoad="init_tf_form('')",
|
|
|
|
)
|
2021-07-29 10:19:00 +02:00
|
|
|
footer = html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
# Liste des enseignants avec forme pour affichage / saisie avec suggestion
|
2021-06-26 21:57:54 +02:00
|
|
|
userlist = sco_users.get_user_list()
|
2021-08-21 23:45:48 +02:00
|
|
|
uid2display = {} # uid : forme pour affichage = "NOM Prenom (login)"(login)"
|
2021-05-31 00:14:15 +02:00
|
|
|
for u in userlist:
|
2021-08-21 23:45:48 +02:00
|
|
|
uid2display[u.id] = u.get_nomplogin()
|
|
|
|
allowed_user_names = list(uid2display.values())
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
H = [
|
|
|
|
"<ul><li><b>%s</b> (responsable)</li>"
|
2021-08-21 23:45:48 +02:00
|
|
|
% uid2display.get(M["responsable_id"], M["responsable_id"])
|
2021-05-31 00:14:15 +02:00
|
|
|
]
|
|
|
|
for ens in M["ens"]:
|
2023-07-11 06:57:38 +02:00
|
|
|
u = db.session.get(User, ens["ens_id"])
|
2021-08-21 23:21:48 +02:00
|
|
|
if u:
|
|
|
|
nom = u.get_nomcomplet()
|
|
|
|
else:
|
|
|
|
nom = "? (compte inconnu)"
|
2021-05-31 00:14:15 +02:00
|
|
|
H.append(
|
2021-08-21 23:21:48 +02:00
|
|
|
f"""
|
|
|
|
<li>{nom} (<a class="stdlink" href="{
|
2022-12-24 22:06:22 +01:00
|
|
|
url_for('notes.edit_enseignants_form_delete',
|
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id,
|
|
|
|
ens_id=ens["ens_id"])
|
2021-08-21 23:21:48 +02:00
|
|
|
}">supprimer</a>)
|
|
|
|
</li>"""
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
H.append("</ul>")
|
2022-12-24 22:06:22 +01:00
|
|
|
F = f"""<p class="help">Les enseignants d'un module ont le droit de
|
2021-05-31 00:14:15 +02:00
|
|
|
saisir et modifier toutes les notes des évaluations de ce module.
|
|
|
|
</p>
|
|
|
|
<p class="help">Pour changer le responsable du module, passez par la
|
2022-12-24 22:06:22 +01:00
|
|
|
page "<a class="stdlink" href="{
|
2023-12-06 20:04:40 +01:00
|
|
|
url_for("notes.formsemestre_editwithmodules", scodoc_dept=g.scodoc_dept,
|
2023-01-14 00:05:39 +01:00
|
|
|
formsemestre_id=M["formsemestre_id"])
|
2022-12-24 22:06:22 +01:00
|
|
|
}">Modification du semestre</a>",
|
|
|
|
accessible uniquement au responsable de la formation (chef de département)
|
2021-05-31 00:14:15 +02:00
|
|
|
</p>
|
2022-12-24 22:06:22 +01:00
|
|
|
"""
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
modform = [
|
|
|
|
("moduleimpl_id", {"input_type": "hidden"}),
|
|
|
|
(
|
|
|
|
"ens_id",
|
|
|
|
{
|
|
|
|
"input_type": "text_suggest",
|
|
|
|
"size": 50,
|
|
|
|
"title": "Ajouter un enseignant",
|
|
|
|
"allowed_values": allowed_user_names,
|
|
|
|
"allow_null": False,
|
|
|
|
"text_suggest_options": {
|
2021-07-05 23:04:39 +02:00
|
|
|
"script": url_for(
|
|
|
|
"users.get_user_list_xml", scodoc_dept=g.scodoc_dept
|
|
|
|
)
|
|
|
|
+ "?",
|
2021-05-31 00:14:15 +02:00
|
|
|
"varname": "start",
|
|
|
|
"json": False,
|
|
|
|
"noresults": "Valeur invalide !",
|
|
|
|
"timeout": 60000,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]
|
|
|
|
tf = TrivialFormulator(
|
2021-09-18 10:10:02 +02:00
|
|
|
request.base_url,
|
2021-09-27 16:42:14 +02:00
|
|
|
scu.get_request_args(),
|
2021-05-31 00:14:15 +02:00
|
|
|
modform,
|
|
|
|
submitlabel="Ajouter enseignant",
|
|
|
|
cancelbutton="Annuler",
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
|
|
|
return header + "\n".join(H) + tf[1] + F + footer
|
|
|
|
elif tf[0] == -1:
|
2021-08-21 23:09:08 +02:00
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=moduleimpl_id,
|
|
|
|
)
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
2021-08-11 00:36:07 +02:00
|
|
|
ens_id = User.get_user_id_from_nomplogin(tf[2]["ens_id"])
|
2021-05-31 00:14:15 +02:00
|
|
|
if not ens_id:
|
|
|
|
H.append(
|
|
|
|
'<p class="help">Pour ajouter un enseignant, choisissez un nom dans le menu</p>'
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
# et qu'il n'est pas deja:
|
|
|
|
if (
|
|
|
|
ens_id in [x["ens_id"] for x in M["ens"]]
|
|
|
|
or ens_id == M["responsable_id"]
|
|
|
|
):
|
|
|
|
H.append(
|
2022-12-24 22:06:22 +01:00
|
|
|
f"""<p class="help">Enseignant {ens_id} déjà dans la liste !</p>"""
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
sco_moduleimpl.do_ens_create(
|
2021-08-20 01:09:55 +02:00
|
|
|
{"moduleimpl_id": moduleimpl_id, "ens_id": ens_id}
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2022-12-24 22:06:22 +01:00
|
|
|
url_for(
|
|
|
|
"notes.edit_enseignants_form",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=moduleimpl_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
return header + "\n".join(H) + tf[1] + F + footer
|
|
|
|
|
|
|
|
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/edit_moduleimpl_resp", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2023-02-10 22:04:09 +01:00
|
|
|
def edit_moduleimpl_resp(moduleimpl_id: int):
|
2021-05-31 00:14:15 +02:00
|
|
|
"""Changement d'un enseignant responsable de module
|
|
|
|
Accessible par Admin et dir des etud si flag resp_can_change_ens
|
|
|
|
"""
|
2023-02-10 22:04:09 +01:00
|
|
|
modimpl: ModuleImpl = ModuleImpl.query.get_or_404(moduleimpl_id)
|
|
|
|
modimpl.can_change_ens_by(current_user, raise_exc=True) # access control
|
2021-05-31 00:14:15 +02:00
|
|
|
H = [
|
2021-06-13 18:29:53 +02:00
|
|
|
html_sco_header.html_sem_header(
|
2023-02-10 22:04:09 +01:00
|
|
|
f"""Modification du responsable du <a href="{
|
|
|
|
url_for("notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
|
|
|
|
}">module {modimpl.module.titre or ""}</a>""",
|
2021-05-31 00:14:15 +02:00
|
|
|
javascripts=["libjs/AutoSuggest.js"],
|
|
|
|
cssstyles=["css/autosuggest_inquisitor.css"],
|
|
|
|
bodyOnLoad="init_tf_form('')",
|
|
|
|
)
|
|
|
|
]
|
2021-06-26 21:57:54 +02:00
|
|
|
help_str = """<p class="help">Taper le début du nom de l'enseignant.</p>"""
|
2021-05-31 00:14:15 +02:00
|
|
|
# Liste des enseignants avec forme pour affichage / saisie avec suggestion
|
2021-07-21 15:53:15 +02:00
|
|
|
userlist = [sco_users.user_info(user=u) for u in sco_users.get_user_list()]
|
2021-08-21 23:45:48 +02:00
|
|
|
uid2display = {} # uid : forme pour affichage = "NOM Prenom (login)"
|
2021-05-31 00:14:15 +02:00
|
|
|
for u in userlist:
|
2021-08-21 23:45:48 +02:00
|
|
|
uid2display[u["id"]] = u["nomplogin"]
|
|
|
|
allowed_user_names = list(uid2display.values())
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2023-02-10 22:04:09 +01:00
|
|
|
initvalues = modimpl.to_dict(with_module=False)
|
2021-08-21 23:45:48 +02:00
|
|
|
initvalues["responsable_id"] = uid2display.get(
|
2023-02-10 22:04:09 +01:00
|
|
|
modimpl.responsable_id, modimpl.responsable_id
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
form = [
|
|
|
|
("moduleimpl_id", {"input_type": "hidden"}),
|
|
|
|
(
|
|
|
|
"responsable_id",
|
|
|
|
{
|
|
|
|
"input_type": "text_suggest",
|
|
|
|
"size": 50,
|
|
|
|
"title": "Responsable du module",
|
|
|
|
"allowed_values": allowed_user_names,
|
|
|
|
"allow_null": False,
|
|
|
|
"text_suggest_options": {
|
2021-07-05 23:04:39 +02:00
|
|
|
"script": url_for(
|
|
|
|
"users.get_user_list_xml", scodoc_dept=g.scodoc_dept
|
|
|
|
)
|
|
|
|
+ "?",
|
2021-05-31 00:14:15 +02:00
|
|
|
"varname": "start",
|
|
|
|
"json": False,
|
|
|
|
"noresults": "Valeur invalide !",
|
|
|
|
"timeout": 60000,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]
|
|
|
|
tf = TrivialFormulator(
|
2021-09-18 10:10:02 +02:00
|
|
|
request.base_url,
|
2021-09-27 16:42:14 +02:00
|
|
|
scu.get_request_args(),
|
2021-05-31 00:14:15 +02:00
|
|
|
form,
|
|
|
|
submitlabel="Changer responsable",
|
|
|
|
cancelbutton="Annuler",
|
|
|
|
initvalues=initvalues,
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
2021-07-29 10:19:00 +02:00
|
|
|
return "\n".join(H) + tf[1] + help_str + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
elif tf[0] == -1:
|
2021-08-21 23:09:08 +02:00
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=moduleimpl_id,
|
|
|
|
)
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
2021-08-11 00:36:07 +02:00
|
|
|
responsable_id = User.get_user_id_from_nomplogin(tf[2]["responsable_id"])
|
2023-02-10 22:04:09 +01:00
|
|
|
if not responsable_id:
|
|
|
|
# presque impossible: tf verifie les valeurs (mais qui peuvent changer entre temps)
|
2021-08-21 23:09:08 +02:00
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=moduleimpl_id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-02-10 22:04:09 +01:00
|
|
|
modimpl.responsable_id = responsable_id
|
|
|
|
db.session.add(modimpl)
|
|
|
|
db.session.commit()
|
|
|
|
flash("Responsable modifié")
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2021-08-21 23:09:08 +02:00
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=moduleimpl_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-08-27 21:49:50 +02:00
|
|
|
@bp.route("/view_module_abs")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2023-08-27 21:49:50 +02:00
|
|
|
def view_module_abs(moduleimpl_id, fmt="html"):
|
|
|
|
"""Visualisation des absences a un module"""
|
|
|
|
modimpl: ModuleImpl = (
|
|
|
|
ModuleImpl.query.filter_by(id=moduleimpl_id)
|
|
|
|
.join(FormSemestre)
|
|
|
|
.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
).first_or_404()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2023-08-27 21:49:50 +02:00
|
|
|
debut_sem = modimpl.formsemestre.date_debut
|
|
|
|
fin_sem = modimpl.formsemestre.date_fin
|
|
|
|
inscrits: list[Identite] = sorted(
|
|
|
|
[i.etud for i in modimpl.inscriptions], key=lambda e: e.sort_key
|
2022-08-04 09:06:58 +02:00
|
|
|
)
|
|
|
|
|
2023-08-27 21:49:50 +02:00
|
|
|
rows = []
|
|
|
|
for etud in inscrits:
|
2023-09-05 14:25:38 +02:00
|
|
|
nb_abs, nb_abs_just = sco_assiduites.formsemestre_get_assiduites_count(
|
|
|
|
etud.id, modimpl.formsemestre, moduleimpl_id=modimpl.id
|
|
|
|
)
|
2023-08-27 21:49:50 +02:00
|
|
|
rows.append(
|
|
|
|
{
|
|
|
|
"nomprenom": etud.nomprenom,
|
|
|
|
"just": nb_abs_just,
|
|
|
|
"nojust": nb_abs - nb_abs_just,
|
|
|
|
"total": nb_abs,
|
|
|
|
"_nomprenom_target": url_for(
|
|
|
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id
|
|
|
|
),
|
|
|
|
}
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H = [
|
2021-06-13 18:29:53 +02:00
|
|
|
html_sco_header.html_sem_header(
|
2023-08-27 21:49:50 +02:00
|
|
|
f"""Absences du <a href="{
|
2023-12-06 20:04:40 +01:00
|
|
|
url_for("notes.moduleimpl_status",
|
2023-08-27 21:49:50 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id
|
|
|
|
)}">module {modimpl.module.titre_str()}</a>""",
|
|
|
|
page_title=f"Absences du module {modimpl.module.titre_str()}",
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
]
|
2023-08-27 21:49:50 +02:00
|
|
|
if not rows and fmt == "html":
|
2021-05-31 00:14:15 +02:00
|
|
|
return (
|
|
|
|
"\n".join(H)
|
|
|
|
+ "<p>Aucune absence signalée</p>"
|
2021-07-29 10:19:00 +02:00
|
|
|
+ html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
tab = GenTable(
|
|
|
|
titles={
|
|
|
|
"nomprenom": "Nom",
|
|
|
|
"just": "Just.",
|
|
|
|
"nojust": "Non Just.",
|
|
|
|
"total": "Total",
|
|
|
|
},
|
|
|
|
columns_ids=("nomprenom", "just", "nojust", "total"),
|
2023-08-27 21:49:50 +02:00
|
|
|
rows=rows,
|
2021-05-31 00:14:15 +02:00
|
|
|
html_class="table_leftalign",
|
2023-08-27 21:49:50 +02:00
|
|
|
base_url=f"{request.base_url}?moduleimpl_id={moduleimpl_id}",
|
|
|
|
filename="absmodule_" + scu.make_filename(modimpl.module.titre_str()),
|
|
|
|
caption=f"Absences dans le module {modimpl.module.titre_str()}",
|
2021-07-28 17:03:54 +02:00
|
|
|
preferences=sco_preferences.SemPreferences(),
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
2023-08-27 21:49:50 +02:00
|
|
|
if fmt != "html":
|
2023-09-21 10:20:19 +02:00
|
|
|
return tab.make_page(fmt=fmt)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2021-07-29 10:19:00 +02:00
|
|
|
return "\n".join(H) + tab.html() + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2022-02-01 17:42:43 +01:00
|
|
|
@bp.route("/delete_ue_expr/<int:formsemestre_id>/<int:ue_id>", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2022-02-01 17:42:43 +01:00
|
|
|
def delete_ue_expr(formsemestre_id: int, ue_id: int):
|
|
|
|
"""Efface une expression de calcul d'UE"""
|
2023-03-20 11:17:38 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2022-02-01 17:42:43 +01:00
|
|
|
if not formsemestre.can_be_edited_by(current_user):
|
2021-05-31 00:14:15 +02:00
|
|
|
raise AccessDenied("vous n'avez pas le droit d'effectuer cette opération")
|
2022-02-01 17:42:43 +01:00
|
|
|
expr = FormSemestreUEComputationExpr.query.filter_by(
|
|
|
|
formsemestre_id=formsemestre_id, ue_id=ue_id
|
|
|
|
).first()
|
|
|
|
if expr is not None:
|
|
|
|
db.session.delete(expr)
|
|
|
|
db.session.commit()
|
|
|
|
flash("formule supprimée")
|
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2022-02-01 17:42:43 +01:00
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre_enseignants_list")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2023-09-21 10:20:19 +02:00
|
|
|
def formsemestre_enseignants_list(formsemestre_id, fmt="html"):
|
2021-05-31 00:14:15 +02:00
|
|
|
"""Liste les enseignants intervenants dans le semestre (resp. modules et chargés de TD)
|
|
|
|
et indique les absences saisies par chacun.
|
|
|
|
"""
|
2023-12-15 03:37:55 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
|
|
|
# resp. de modules et charges de TD
|
|
|
|
sem_ens: dict[
|
|
|
|
int, list[ModuleImpl]
|
|
|
|
] = {} # uid : { "mods" : liste des modimpls, ... }
|
|
|
|
modimpls = formsemestre.modimpls_sorted
|
|
|
|
for modimpl in modimpls:
|
|
|
|
if not modimpl.responsable_id in sem_ens:
|
|
|
|
sem_ens[modimpl.responsable_id] = {"mods": [modimpl]}
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
2023-12-15 03:37:55 +01:00
|
|
|
sem_ens[modimpl.responsable_id]["mods"].append(modimpl)
|
|
|
|
|
|
|
|
for enseignant in modimpl.enseignants:
|
|
|
|
if not enseignant.id in sem_ens:
|
|
|
|
sem_ens[enseignant.id] = {"mods": [modimpl]}
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
2023-12-15 03:37:55 +01:00
|
|
|
sem_ens[enseignant.id]["mods"].append(modimpl)
|
2021-05-31 00:14:15 +02:00
|
|
|
# compte les absences ajoutées par chacun dans tout le semestre
|
2023-12-15 03:37:55 +01:00
|
|
|
for uid, info in sem_ens.items():
|
|
|
|
# Note : avant 9.6, on utilisait Scolog pour compter les opérations AddAbsence
|
|
|
|
# ici on compte directement les assiduités
|
|
|
|
info["nbabsadded"] = (
|
|
|
|
Assiduite.query.filter_by(user_id=uid, etat=scu.EtatAssiduite.ABSENT)
|
|
|
|
.filter(
|
|
|
|
Assiduite.date_debut >= formsemestre.date_debut,
|
|
|
|
Assiduite.date_debut <= formsemestre.date_fin,
|
|
|
|
)
|
|
|
|
.join(Identite)
|
|
|
|
.join(FormSemestreInscription)
|
|
|
|
.filter_by(formsemestre_id=formsemestre.id)
|
|
|
|
.count()
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
# description textuelle des modules
|
2023-12-15 03:37:55 +01:00
|
|
|
for uid, info in sem_ens.items():
|
|
|
|
info["descr_mods"] = ", ".join(
|
|
|
|
[modimpl.module.code for modimpl in sem_ens[uid]["mods"]]
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# ajoute infos sur enseignant:
|
2023-12-15 03:37:55 +01:00
|
|
|
for uid, info in sem_ens.items():
|
|
|
|
user: User = db.session.get(User, uid)
|
|
|
|
if user:
|
|
|
|
if user.email:
|
|
|
|
info["email"] = user.email
|
|
|
|
info["_email_target"] = f"mailto:{user.email}"
|
|
|
|
info["nom_fmt"] = user.get_nom_fmt()
|
|
|
|
info["prenom_fmt"] = user.get_prenom_fmt()
|
|
|
|
info["sort_key"] = user.sort_key()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2021-07-09 13:45:10 +02:00
|
|
|
sem_ens_list = list(sem_ens.values())
|
2023-12-15 03:37:55 +01:00
|
|
|
sem_ens_list.sort(key=itemgetter("sort_key"))
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
# --- Generate page with table
|
2023-12-15 03:37:55 +01:00
|
|
|
title = f"Enseignants de {formsemestre.titre_mois()}"
|
2021-05-31 00:14:15 +02:00
|
|
|
T = GenTable(
|
|
|
|
columns_ids=["nom_fmt", "prenom_fmt", "descr_mods", "nbabsadded", "email"],
|
|
|
|
titles={
|
|
|
|
"nom_fmt": "Nom",
|
|
|
|
"prenom_fmt": "Prénom",
|
|
|
|
"email": "Mail",
|
|
|
|
"descr_mods": "Modules",
|
|
|
|
"nbabsadded": "Saisies Abs.",
|
|
|
|
},
|
|
|
|
rows=sem_ens_list,
|
|
|
|
html_sortable=True,
|
2023-12-15 03:48:15 +01:00
|
|
|
html_class="table_leftalign formsemestre_enseignants_list",
|
|
|
|
html_with_td_classes=True,
|
2023-12-15 03:37:55 +01:00
|
|
|
filename=scu.make_filename(f"Enseignants-{formsemestre.titre_annee()}"),
|
2021-06-13 18:29:53 +02:00
|
|
|
html_title=html_sco_header.html_sem_header(
|
2022-01-07 15:11:24 +01:00
|
|
|
"Enseignants du semestre", with_page_header=False
|
2021-05-31 00:14:15 +02:00
|
|
|
),
|
2023-12-15 03:37:55 +01:00
|
|
|
base_url=f"{request.base_url}?formsemestre_id={formsemestre_id}",
|
|
|
|
caption="""Tous les enseignants (responsables ou associés aux modules de
|
|
|
|
ce semestre) apparaissent. Le nombre de saisies d'absences est indicatif.""",
|
2021-07-28 17:03:54 +02:00
|
|
|
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2023-09-21 10:20:19 +02:00
|
|
|
return T.make_page(page_title=title, title=title, fmt=fmt)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/edit_enseignants_form_delete", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-08-22 13:24:36 +02:00
|
|
|
def edit_enseignants_form_delete(moduleimpl_id, ens_id: int):
|
2021-08-14 18:54:32 +02:00
|
|
|
"""remove ens from this modueimpl
|
|
|
|
|
|
|
|
ens_id: user.id
|
|
|
|
"""
|
2021-08-22 13:24:36 +02:00
|
|
|
M, _ = sco_moduleimpl.can_change_ens(moduleimpl_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
# search ens_id
|
|
|
|
ok = False
|
|
|
|
for ens in M["ens"]:
|
|
|
|
if ens["ens_id"] == ens_id:
|
|
|
|
ok = True
|
|
|
|
break
|
|
|
|
if not ok:
|
2022-12-24 22:06:22 +01:00
|
|
|
raise ScoValueError(f"invalid ens_id ({ens_id})")
|
2021-08-14 18:54:32 +02:00
|
|
|
ndb.SimpleQuery(
|
|
|
|
"""DELETE FROM notes_modules_enseignants
|
2022-12-24 22:06:22 +01:00
|
|
|
WHERE moduleimpl_id = %(moduleimpl_id)s
|
2021-08-14 18:54:32 +02:00
|
|
|
AND ens_id = %(ens_id)s
|
|
|
|
""",
|
2021-08-21 23:45:48 +02:00
|
|
|
{"moduleimpl_id": moduleimpl_id, "ens_id": ens_id},
|
2021-08-14 18:54:32 +02:00
|
|
|
)
|
2022-12-24 22:06:22 +01:00
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.edit_enseignants_form",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
moduleimpl_id=moduleimpl_id,
|
|
|
|
)
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2021-06-16 16:59:31 +02:00
|
|
|
# --- Gestion des inscriptions aux semestres
|
|
|
|
|
|
|
|
# Ancienne API, pas certain de la publier en ScoDoc8
|
|
|
|
# sco_publish(
|
|
|
|
# "/do_formsemestre_inscription_create",
|
|
|
|
# sco_formsemestre_inscriptions.do_formsemestre_inscription_create,
|
2023-09-29 21:17:31 +02:00
|
|
|
# Permission.EtudInscrit,
|
2021-06-16 16:59:31 +02:00
|
|
|
# )
|
|
|
|
# sco_publish(
|
|
|
|
# "/do_formsemestre_inscription_edit",
|
|
|
|
# sco_formsemestre_inscriptions.do_formsemestre_inscription_edit,
|
2023-09-29 21:17:31 +02:00
|
|
|
# Permission.EtudInscrit,
|
2021-06-16 16:59:31 +02:00
|
|
|
# )
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2021-06-16 16:59:31 +02:00
|
|
|
sco_publish(
|
|
|
|
"/do_formsemestre_inscription_list",
|
|
|
|
sco_formsemestre_inscriptions.do_formsemestre_inscription_list,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/do_formsemestre_inscription_listinscrits")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2023-09-21 10:20:19 +02:00
|
|
|
def do_formsemestre_inscription_listinscrits(formsemestre_id, fmt=None):
|
2021-05-31 00:14:15 +02:00
|
|
|
"""Liste les inscrits (état I) à ce semestre et cache le résultat"""
|
2021-06-21 10:17:16 +02:00
|
|
|
r = sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits(
|
2021-08-19 10:28:35 +02:00
|
|
|
formsemestre_id
|
2021-06-21 10:17:16 +02:00
|
|
|
)
|
2023-09-21 10:20:19 +02:00
|
|
|
return scu.sendResult(r, fmt=fmt, name="inscrits")
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2021-08-22 15:36:17 +02:00
|
|
|
@bp.route("/formsemestre_desinscription", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormSemestre)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_desinscription(etudid, formsemestre_id, dialog_confirmed=False):
|
2022-09-03 11:41:56 +02:00
|
|
|
"""désinscrit l'etudiant de ce semestre (et donc de tous les modules).
|
2021-05-31 00:14:15 +02:00
|
|
|
A n'utiliser qu'en cas d'erreur de saisie.
|
|
|
|
S'il s'agit d'un semestre extérieur et qu'il n'y a plus d'inscrit,
|
|
|
|
le semestre sera supprimé.
|
|
|
|
"""
|
2022-02-13 23:53:11 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
sem = formsemestre.to_dict() # compat
|
2021-05-31 00:14:15 +02:00
|
|
|
# -- check lock
|
2022-02-13 23:53:11 +01:00
|
|
|
if not formsemestre.etat:
|
2021-05-31 00:14:15 +02:00
|
|
|
raise ScoValueError("desinscription impossible: semestre verrouille")
|
|
|
|
|
|
|
|
# -- Si décisions de jury, désinscription interdite
|
2022-02-13 23:53:11 +01:00
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
2021-05-31 00:14:15 +02:00
|
|
|
if nt.etud_has_decision(etudid):
|
|
|
|
raise ScoValueError(
|
2022-09-03 11:41:56 +02:00
|
|
|
f"""Désinscription impossible: l'étudiant a une décision de jury
|
|
|
|
(la supprimer avant si nécessaire:
|
|
|
|
<a href="{
|
|
|
|
url_for("notes.formsemestre_validation_suppress_etud",
|
|
|
|
scodoc_dept=g.scodoc_dept, etudid=etudid,
|
|
|
|
formsemestre_id=formsemestre_id)
|
|
|
|
}">supprimer décision jury</a>
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
if not dialog_confirmed:
|
2021-08-22 13:24:36 +02:00
|
|
|
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
2022-02-13 23:53:11 +01:00
|
|
|
if formsemestre.modalite != "EXT":
|
2021-05-31 00:14:15 +02:00
|
|
|
msg_ext = """
|
|
|
|
<p>%s sera désinscrit de tous les modules du semestre %s (%s - %s).</p>
|
|
|
|
<p>Cette opération ne doit être utilisée que pour corriger une <b>erreur</b> !
|
|
|
|
Un étudiant réellement inscrit doit le rester, le faire éventuellement <b>démissionner<b>.
|
|
|
|
</p>
|
|
|
|
""" % (
|
|
|
|
etud["nomprenom"],
|
|
|
|
sem["titre_num"],
|
|
|
|
sem["date_debut"],
|
|
|
|
sem["date_fin"],
|
|
|
|
)
|
|
|
|
else: # semestre extérieur
|
|
|
|
msg_ext = """
|
|
|
|
<p>%s sera désinscrit du semestre extérieur %s (%s - %s).</p>
|
|
|
|
""" % (
|
|
|
|
etud["nomprenom"],
|
|
|
|
sem["titre_num"],
|
|
|
|
sem["date_debut"],
|
|
|
|
sem["date_fin"],
|
|
|
|
)
|
2021-06-16 18:18:32 +02:00
|
|
|
inscrits = sco_formsemestre_inscriptions.do_formsemestre_inscription_list(
|
2021-08-19 10:28:35 +02:00
|
|
|
args={"formsemestre_id": formsemestre_id}
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
nbinscrits = len(inscrits)
|
|
|
|
if nbinscrits <= 1:
|
2022-09-03 11:41:56 +02:00
|
|
|
msg_ext = """<p class="warning">Attention: le semestre extérieur
|
|
|
|
sera supprimé car il n'a pas d'autre étudiant inscrit.
|
2021-05-31 00:14:15 +02:00
|
|
|
</p>
|
|
|
|
"""
|
2021-06-02 22:40:34 +02:00
|
|
|
return scu.confirm_dialog(
|
2022-09-03 11:41:56 +02:00
|
|
|
"""<h2>Confirmer la demande de désinscription ?</h2>""" + msg_ext,
|
2021-05-31 00:14:15 +02:00
|
|
|
dest_url="",
|
2022-09-03 11:41:56 +02:00
|
|
|
cancel_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
),
|
2021-05-31 00:14:15 +02:00
|
|
|
parameters={"etudid": etudid, "formsemestre_id": formsemestre_id},
|
|
|
|
)
|
|
|
|
|
2021-06-21 10:17:16 +02:00
|
|
|
sco_formsemestre_inscriptions.do_formsemestre_desinscription(
|
2021-09-02 18:05:22 +02:00
|
|
|
etudid, formsemestre_id
|
2021-06-21 10:17:16 +02:00
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2022-09-03 11:41:56 +02:00
|
|
|
flash("Étudiant désinscrit")
|
|
|
|
return redirect(
|
|
|
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-16 16:59:31 +02:00
|
|
|
sco_publish(
|
|
|
|
"/do_formsemestre_desinscription",
|
|
|
|
sco_formsemestre_inscriptions.do_formsemestre_desinscription,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-08-22 15:36:17 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-06-16 16:59:31 +02:00
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2023-01-12 17:08:39 +01:00
|
|
|
@bp.route(
|
|
|
|
"/etud_desinscrit_ue/<int:etudid>/<int:formsemestre_id>/<int:ue_id>",
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2021-09-27 10:20:10 +02:00
|
|
|
def etud_desinscrit_ue(etudid, formsemestre_id, ue_id):
|
2022-12-01 13:00:14 +01:00
|
|
|
"""
|
|
|
|
- En classique: désinscrit l'etudiant de tous les modules de cette UE dans ce semestre.
|
|
|
|
- En APC: dispense de l'UE indiquée.
|
|
|
|
"""
|
2023-03-20 11:17:38 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
2022-12-01 13:00:14 +01:00
|
|
|
ue = UniteEns.query.get_or_404(ue_id)
|
2023-03-20 11:17:38 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2022-12-01 13:00:14 +01:00
|
|
|
if ue.formation.is_apc():
|
2023-01-13 23:23:18 +01:00
|
|
|
if (
|
|
|
|
DispenseUE.query.filter_by(
|
|
|
|
formsemestre_id=formsemestre_id, etudid=etudid, ue_id=ue_id
|
|
|
|
).count()
|
|
|
|
== 0
|
|
|
|
):
|
|
|
|
disp = DispenseUE(
|
|
|
|
formsemestre_id=formsemestre_id, ue_id=ue_id, etudid=etudid
|
|
|
|
)
|
2022-12-01 13:00:14 +01:00
|
|
|
db.session.add(disp)
|
|
|
|
db.session.commit()
|
2023-01-12 17:08:39 +01:00
|
|
|
log(f"etud_desinscrit_ue {etud} {ue}")
|
|
|
|
Scolog.logdb(
|
|
|
|
method="etud_desinscrit_ue",
|
|
|
|
etudid=etud.id,
|
2023-01-13 23:23:18 +01:00
|
|
|
msg=f"Désinscription de l'UE {ue.acronyme} de {formsemestre.titre_annee()}",
|
2023-01-12 17:08:39 +01:00
|
|
|
commit=True,
|
|
|
|
)
|
2022-12-01 13:00:14 +01:00
|
|
|
sco_cache.invalidate_formsemestre(formsemestre_id=formsemestre.id)
|
|
|
|
else:
|
|
|
|
sco_moduleimpl_inscriptions.do_etud_desinscrit_ue_classic(
|
|
|
|
etudid, formsemestre_id, ue_id
|
|
|
|
)
|
|
|
|
flash(f"{etud.nomprenom} déinscrit de {ue.acronyme}")
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2022-12-01 13:00:14 +01:00
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_inscriptions_stats",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-01-12 17:08:39 +01:00
|
|
|
@bp.route(
|
|
|
|
"/etud_inscrit_ue/<int:etudid>/<int:formsemestre_id>/<int:ue_id>",
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2021-09-27 10:20:10 +02:00
|
|
|
def etud_inscrit_ue(etudid, formsemestre_id, ue_id):
|
2022-12-07 20:06:01 +01:00
|
|
|
"""
|
|
|
|
En classic: inscrit l'étudiant à tous les modules de cette UE dans ce semestre.
|
|
|
|
En APC: enlève la dispense de cette UE s'il y en a une.
|
|
|
|
"""
|
|
|
|
formsemestre = FormSemestre.query.filter_by(
|
|
|
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2023-03-20 11:17:38 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
2022-12-07 20:06:01 +01:00
|
|
|
ue = UniteEns.query.get_or_404(ue_id)
|
|
|
|
if ue.formation.is_apc():
|
2023-01-13 23:23:18 +01:00
|
|
|
for disp in DispenseUE.query.filter_by(
|
|
|
|
formsemestre_id=formsemestre_id, etudid=etud.id, ue_id=ue_id
|
|
|
|
):
|
2022-12-07 20:06:01 +01:00
|
|
|
db.session.delete(disp)
|
2023-01-12 17:08:39 +01:00
|
|
|
log(f"etud_inscrit_ue {etud} {ue}")
|
|
|
|
Scolog.logdb(
|
|
|
|
method="etud_inscrit_ue",
|
|
|
|
etudid=etud.id,
|
2023-01-13 23:23:18 +01:00
|
|
|
msg=f"Inscription à l'UE {ue.acronyme} de {formsemestre.titre_annee()}",
|
2023-01-12 17:08:39 +01:00
|
|
|
commit=True,
|
|
|
|
)
|
2022-12-07 20:06:01 +01:00
|
|
|
db.session.commit()
|
|
|
|
sco_cache.invalidate_formsemestre(formsemestre_id=formsemestre.id)
|
|
|
|
else:
|
|
|
|
# Formations classiques: joue sur les inscriptions aux modules
|
|
|
|
sco_moduleimpl_inscriptions.do_etud_inscrit_ue(etud.id, formsemestre_id, ue_id)
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2022-12-07 20:06:01 +01:00
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_inscriptions_stats",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# --- Inscriptions
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_inscription_with_modules_form",
|
|
|
|
sco_formsemestre_inscriptions.formsemestre_inscription_with_modules_form,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_inscription_with_modules_etud",
|
|
|
|
sco_formsemestre_inscriptions.formsemestre_inscription_with_modules_etud,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_inscription_with_modules",
|
|
|
|
sco_formsemestre_inscriptions.formsemestre_inscription_with_modules,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_inscription_option",
|
|
|
|
sco_formsemestre_inscriptions.formsemestre_inscription_option,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-07-05 23:53:23 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/do_moduleimpl_incription_options",
|
|
|
|
sco_formsemestre_inscriptions.do_moduleimpl_incription_options,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_inscrits_ailleurs",
|
|
|
|
sco_formsemestre_inscriptions.formsemestre_inscrits_ailleurs,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/moduleimpl_inscriptions_edit",
|
|
|
|
sco_moduleimpl_inscriptions.moduleimpl_inscriptions_edit,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-07-12 23:34:18 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/moduleimpl_inscriptions_stats",
|
|
|
|
sco_moduleimpl_inscriptions.moduleimpl_inscriptions_stats,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# --- Evaluations
|
|
|
|
|
|
|
|
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/evaluation_delete", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EnsView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def evaluation_delete(evaluation_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"""Form delete evaluation"""
|
2023-08-30 09:22:51 +02:00
|
|
|
evaluation: Evaluation = (
|
|
|
|
Evaluation.query.filter_by(id=evaluation_id)
|
|
|
|
.join(ModuleImpl)
|
|
|
|
.join(FormSemestre)
|
|
|
|
.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
.first_or_404()
|
|
|
|
)
|
|
|
|
|
|
|
|
tit = f"""Suppression de l'évaluation {evaluation.description or ""} ({evaluation.descr_date()})"""
|
|
|
|
etat = sco_evaluations.do_evaluation_etat(evaluation.id)
|
2021-05-31 00:14:15 +02:00
|
|
|
H = [
|
2023-08-30 09:22:51 +02:00
|
|
|
f"""
|
|
|
|
{html_sco_header.html_sem_header(tit, with_h2=False)}
|
|
|
|
<h2 class="formsemestre">Module <tt>{evaluation.moduleimpl.module.code}</tt>
|
|
|
|
{evaluation.moduleimpl.module.titre_str()}</h2>
|
|
|
|
<h3>{tit}</h3>
|
|
|
|
<p class="help">Opération <span class="redboldtext">irréversible</span>.
|
|
|
|
Si vous supprimez l'évaluation, vous ne pourrez pas retrouver les notes associées.
|
|
|
|
</p>
|
|
|
|
""",
|
2021-05-31 00:14:15 +02:00
|
|
|
]
|
|
|
|
warning = False
|
|
|
|
if etat["nb_notes_total"]:
|
|
|
|
warning = True
|
|
|
|
nb_desinscrits = etat["nb_notes_total"] - etat["nb_notes"]
|
|
|
|
H.append(
|
2023-08-30 09:22:51 +02:00
|
|
|
f"""<div class="ue_warning"><span>Il y a {etat["nb_notes_total"]} notes"""
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
if nb_desinscrits:
|
|
|
|
H.append(
|
2023-08-30 09:22:51 +02:00
|
|
|
""" (dont {nb_desinscrits} d'étudiants qui ne sont plus inscrits)"""
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
H.append(""" dans l'évaluation</span>""")
|
|
|
|
if etat["nb_notes"] == 0:
|
|
|
|
H.append(
|
|
|
|
"""<p>Vous pouvez quand même supprimer l'évaluation, les notes des étudiants désincrits seront effacées.</p>"""
|
|
|
|
)
|
|
|
|
|
|
|
|
if etat["nb_notes"]:
|
|
|
|
H.append(
|
2023-08-30 09:22:51 +02:00
|
|
|
f"""<p>Suppression impossible (effacer les notes d'abord)</p>
|
2023-12-06 20:04:40 +01:00
|
|
|
<p><a class="stdlink" href="{
|
|
|
|
url_for("notes.moduleimpl_status",
|
2023-08-30 09:22:51 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, moduleimpl_id=evaluation.moduleimpl_id)
|
|
|
|
}">retour au tableau de bord du module</a>
|
|
|
|
</p>
|
|
|
|
</div>"""
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2021-07-29 10:19:00 +02:00
|
|
|
return "\n".join(H) + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
if warning:
|
|
|
|
H.append("""</div>""")
|
|
|
|
|
|
|
|
tf = TrivialFormulator(
|
2021-09-18 10:10:02 +02:00
|
|
|
request.base_url,
|
2021-09-27 16:42:14 +02:00
|
|
|
scu.get_request_args(),
|
2021-05-31 00:14:15 +02:00
|
|
|
(("evaluation_id", {"input_type": "hidden"}),),
|
2023-08-30 09:22:51 +02:00
|
|
|
initvalues={"evaluation_id": evaluation.id},
|
2021-05-31 00:14:15 +02:00
|
|
|
submitlabel="Confirmer la suppression",
|
|
|
|
cancelbutton="Annuler",
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
2021-07-29 10:19:00 +02:00
|
|
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
elif tf[0] == -1:
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2021-08-15 22:08:38 +02:00
|
|
|
url_for(
|
|
|
|
"notes.moduleimpl_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2023-08-30 09:22:51 +02:00
|
|
|
moduleimpl_id=evaluation.moduleimpl_id,
|
2021-08-15 22:08:38 +02:00
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
else:
|
2023-08-30 09:22:51 +02:00
|
|
|
evaluation.delete()
|
2021-05-31 00:14:15 +02:00
|
|
|
return (
|
|
|
|
"\n".join(H)
|
2021-08-15 22:08:38 +02:00
|
|
|
+ f"""<p>OK, évaluation supprimée.</p>
|
|
|
|
<p><a class="stdlink" href="{
|
2023-12-06 20:04:40 +01:00
|
|
|
url_for("notes.moduleimpl_status", scodoc_dept=g.scodoc_dept,
|
2023-08-30 09:22:51 +02:00
|
|
|
moduleimpl_id=evaluation.moduleimpl_id)
|
2021-08-15 22:08:38 +02:00
|
|
|
}">Continuer</a></p>"""
|
2021-07-29 10:19:00 +02:00
|
|
|
+ html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
@bp.route("/evaluation_edit", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EnsView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def evaluation_edit(evaluation_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"form edit evaluation"
|
2021-11-12 22:17:46 +01:00
|
|
|
return sco_evaluation_edit.evaluation_create_form(
|
2021-09-27 10:20:10 +02:00
|
|
|
evaluation_id=evaluation_id, edit=True
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-21 14:40:58 +02:00
|
|
|
@bp.route("/evaluation_create", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EnsView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def evaluation_create(moduleimpl_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"form create evaluation"
|
2023-07-11 06:57:38 +02:00
|
|
|
modimpl = db.session.get(ModuleImpl, moduleimpl_id)
|
2022-08-25 12:47:57 +02:00
|
|
|
if modimpl is None:
|
|
|
|
raise ScoValueError("Ce module n'existe pas ou plus !")
|
2021-11-12 22:17:46 +01:00
|
|
|
return sco_evaluation_edit.evaluation_create_form(
|
2021-09-27 10:20:10 +02:00
|
|
|
moduleimpl_id=moduleimpl_id, edit=False
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-11-09 22:12:11 +01:00
|
|
|
@bp.route("/evaluation_listenotes", methods=["GET", "POST"]) # API ScoDoc 7 compat
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-11-09 22:12:11 +01:00
|
|
|
@permission_required_compat_scodoc7(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def evaluation_listenotes():
|
2021-05-31 00:14:15 +02:00
|
|
|
"""Affichage des notes d'une évaluation"""
|
2021-12-18 12:16:49 +01:00
|
|
|
evaluation_id = None
|
|
|
|
moduleimpl_id = None
|
|
|
|
vals = scu.get_request_args()
|
2022-04-11 08:03:27 +02:00
|
|
|
try:
|
|
|
|
if "evaluation_id" in vals:
|
|
|
|
evaluation_id = int(vals["evaluation_id"])
|
|
|
|
if "moduleimpl_id" in vals and vals["moduleimpl_id"]:
|
|
|
|
moduleimpl_id = int(vals["moduleimpl_id"])
|
|
|
|
except ValueError as exc:
|
2022-09-18 16:53:00 +02:00
|
|
|
raise ScoValueError("evaluation_listenotes: id invalides !") from exc
|
2021-12-18 12:16:49 +01:00
|
|
|
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt = vals.get("fmt", "html")
|
2021-12-20 20:38:21 +01:00
|
|
|
html_content, page_title = sco_liste_notes.do_evaluation_listenotes(
|
2023-09-21 10:20:19 +02:00
|
|
|
evaluation_id=evaluation_id, moduleimpl_id=moduleimpl_id, fmt=fmt
|
2021-12-18 12:16:49 +01:00
|
|
|
)
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt == "html":
|
2021-06-13 18:29:53 +02:00
|
|
|
H = html_sco_header.sco_header(
|
2021-12-18 12:16:49 +01:00
|
|
|
page_title=page_title,
|
2021-05-31 00:14:15 +02:00
|
|
|
cssstyles=["css/verticalhisto.css"],
|
|
|
|
javascripts=["js/etud_info.js"],
|
|
|
|
init_qtip=True,
|
|
|
|
)
|
2021-07-29 10:19:00 +02:00
|
|
|
F = html_sco_header.sco_footer()
|
2021-12-20 20:38:21 +01:00
|
|
|
return H + html_content + F
|
2021-08-22 00:21:00 +02:00
|
|
|
else:
|
2021-12-20 20:38:21 +01:00
|
|
|
return html_content
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
sco_publish(
|
|
|
|
"/evaluation_list_operations",
|
|
|
|
sco_undo_notes.evaluation_list_operations,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2023-09-06 08:48:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/evaluation_check_absences_html/<int:evaluation_id>")
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
def evaluation_check_absences_html(evaluation_id: int):
|
|
|
|
"Check absences sur une évaluation"
|
2023-09-06 21:34:12 +02:00
|
|
|
evaluation: Evaluation = (
|
|
|
|
Evaluation.query.filter_by(id=evaluation_id)
|
|
|
|
.join(ModuleImpl)
|
|
|
|
.join(FormSemestre)
|
|
|
|
.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
.first_or_404()
|
|
|
|
)
|
2023-09-06 08:48:00 +02:00
|
|
|
return sco_evaluation_check_abs.evaluation_check_absences_html(evaluation)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_check_absences_html",
|
2021-11-20 17:53:21 +01:00
|
|
|
sco_evaluation_check_abs.formsemestre_check_absences_html,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Placement des étudiants pour l'évaluation
|
|
|
|
sco_publish(
|
|
|
|
"/placement_eval_selectetuds",
|
|
|
|
sco_placement.placement_eval_selectetuds,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EnsView,
|
2021-09-05 14:50:35 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# --- Saisie des notes
|
|
|
|
sco_publish(
|
|
|
|
"/saisie_notes_tableur",
|
|
|
|
sco_saisie_notes.saisie_notes_tableur,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EnsView,
|
2021-08-11 11:40:28 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/feuille_saisie_notes",
|
|
|
|
sco_saisie_notes.feuille_saisie_notes,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EnsView,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2023-09-29 21:17:31 +02:00
|
|
|
sco_publish("/saisie_notes", sco_saisie_notes.saisie_notes, Permission.EnsView)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/do_evaluation_set_missing",
|
|
|
|
sco_saisie_notes.do_evaluation_set_missing,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EnsView,
|
2021-07-28 08:12:57 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/evaluation_suppress_alln",
|
|
|
|
sco_saisie_notes.evaluation_suppress_alln,
|
|
|
|
Permission.ScoView,
|
2021-07-28 08:12:57 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# --- Bulletins
|
|
|
|
@bp.route("/formsemestre_bulletins_pdf")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_bulletins_pdf(formsemestre_id, version="selectedevals"):
|
2021-05-31 00:14:15 +02:00
|
|
|
"Publie les bulletins dans un classeur PDF"
|
|
|
|
pdfdoc, filename = sco_bulletins_pdf.get_formsemestre_bulletins_pdf(
|
2021-09-27 10:20:10 +02:00
|
|
|
formsemestre_id, version=version
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2021-09-21 15:53:33 +02:00
|
|
|
return scu.sendPDFFile(pdfdoc, filename)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2022-03-12 09:38:48 +01:00
|
|
|
_EXPL_BULL = """Versions des bulletins:
|
|
|
|
<ul>
|
|
|
|
<li><bf>courte</bf>: moyennes des modules (en BUT: seulement les moyennes d'UE)</li>
|
|
|
|
<li><bf>intermédiaire</bf>: moyennes des modules et notes des évaluations sélectionnées</li>
|
|
|
|
<li><bf>complète</bf>: toutes les notes</li>
|
|
|
|
</ul>"""
|
2021-06-19 23:21:37 +02:00
|
|
|
|
|
|
|
|
2021-06-14 00:23:22 +02:00
|
|
|
@bp.route("/formsemestre_bulletins_pdf_choice")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-06-14 00:23:22 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_bulletins_pdf_choice(formsemestre_id, version=None):
|
2023-10-13 22:25:44 +02:00
|
|
|
"""Choix version puis envoi classeur bulletins pdf"""
|
2023-12-06 20:40:55 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2021-06-14 00:23:22 +02:00
|
|
|
if version:
|
|
|
|
pdfdoc, filename = sco_bulletins_pdf.get_formsemestre_bulletins_pdf(
|
2021-09-27 10:20:10 +02:00
|
|
|
formsemestre_id, version=version
|
2021-06-14 00:23:22 +02:00
|
|
|
)
|
2021-09-21 15:53:33 +02:00
|
|
|
return scu.sendPDFFile(pdfdoc, filename)
|
2023-12-06 20:40:55 +01:00
|
|
|
return _formsemestre_bulletins_choice(
|
|
|
|
formsemestre,
|
2021-06-14 00:23:22 +02:00
|
|
|
title="Choisir la version des bulletins à générer",
|
2021-06-19 23:21:37 +02:00
|
|
|
explanation=_EXPL_BULL,
|
2021-06-14 00:23:22 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
@bp.route("/etud_bulletins_pdf")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def etud_bulletins_pdf(etudid, version="selectedevals"):
|
2021-05-31 00:14:15 +02:00
|
|
|
"Publie tous les bulletins d'un etudiants dans un classeur PDF"
|
2023-10-13 22:25:44 +02:00
|
|
|
if version not in scu.BULLETINS_VERSIONS:
|
2023-12-06 20:40:55 +01:00
|
|
|
raise ScoValueError("etud_bulletins_pdf: version de bulletin demandée invalide")
|
2021-09-27 10:20:10 +02:00
|
|
|
pdfdoc, filename = sco_bulletins_pdf.get_etud_bulletins_pdf(etudid, version=version)
|
2021-09-21 15:53:33 +02:00
|
|
|
return scu.sendPDFFile(pdfdoc, filename)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2021-06-14 00:23:22 +02:00
|
|
|
@bp.route("/formsemestre_bulletins_mailetuds_choice")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-06-14 00:23:22 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-06-14 00:23:22 +02:00
|
|
|
def formsemestre_bulletins_mailetuds_choice(
|
|
|
|
formsemestre_id,
|
|
|
|
version=None,
|
|
|
|
dialog_confirmed=False,
|
|
|
|
prefer_mail_perso=0,
|
|
|
|
):
|
2021-08-21 00:24:51 +02:00
|
|
|
"""Choix version puis envoi classeur bulletins pdf"""
|
2021-06-14 00:23:22 +02:00
|
|
|
if version:
|
2021-08-21 00:24:51 +02:00
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_bulletins_mailetuds",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
version=version,
|
|
|
|
dialog_confirmed=dialog_confirmed,
|
|
|
|
prefer_mail_perso=prefer_mail_perso,
|
|
|
|
)
|
2021-06-14 00:23:22 +02:00
|
|
|
)
|
2023-12-06 20:40:55 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2022-10-03 09:46:33 +02:00
|
|
|
expl_bull = """Versions des bulletins:
|
|
|
|
<ul>
|
|
|
|
<li><b>courte</b>: moyennes des modules</li>
|
|
|
|
<li><b>intermédiaire</b>: moyennes des modules et notes des évaluations sélectionnées</li>
|
|
|
|
<li><b>complète</b>: toutes les notes</li>
|
2023-12-06 20:40:55 +01:00
|
|
|
"""
|
|
|
|
if formsemestre.formation.is_apc():
|
|
|
|
expl_bull += """
|
|
|
|
<li><b>courte spéciale BUT</b>: un résumé en une page pour les BUTs</li>
|
|
|
|
"""
|
|
|
|
expl_bull += "</ul>"
|
|
|
|
return _formsemestre_bulletins_choice(
|
|
|
|
formsemestre,
|
2021-06-14 00:23:22 +02:00
|
|
|
title="Choisir la version des bulletins à envoyer par mail",
|
2022-10-03 09:46:33 +02:00
|
|
|
explanation="""Chaque étudiant (non démissionnaire ni défaillant)
|
|
|
|
ayant une adresse mail connue de ScoDoc
|
|
|
|
recevra une copie PDF de son bulletin de notes, dans la version choisie.
|
|
|
|
</p><p>"""
|
2021-06-14 00:23:22 +02:00
|
|
|
+ expl_bull,
|
|
|
|
choose_mail=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-14 18:08:52 +02:00
|
|
|
# not published
|
2023-12-06 20:40:55 +01:00
|
|
|
def _formsemestre_bulletins_choice(
|
|
|
|
formsemestre: FormSemestre, title="", explanation="", choose_mail=False
|
2021-06-14 00:23:22 +02:00
|
|
|
):
|
|
|
|
"""Choix d'une version de bulletin"""
|
2023-12-06 20:40:55 +01:00
|
|
|
versions = (
|
|
|
|
scu.BULLETINS_VERSIONS_BUT
|
|
|
|
if formsemestre.formation.is_apc()
|
|
|
|
else scu.BULLETINS_VERSIONS
|
|
|
|
)
|
2021-06-14 00:23:22 +02:00
|
|
|
H = [
|
2022-01-07 15:11:24 +01:00
|
|
|
html_sco_header.html_sem_header(title),
|
2022-10-03 09:46:33 +02:00
|
|
|
f"""
|
|
|
|
<form name="f" method="GET" action="{request.base_url}">
|
2023-12-06 20:40:55 +01:00
|
|
|
<input type="hidden" name="formsemestre_id" value="{formsemestre.id}"></input>
|
2022-10-03 09:46:33 +02:00
|
|
|
""",
|
2021-06-14 00:23:22 +02:00
|
|
|
]
|
|
|
|
H.append("""<select name="version" class="noprint">""")
|
2023-12-06 20:40:55 +01:00
|
|
|
for version, description in versions.items():
|
2022-10-03 09:46:33 +02:00
|
|
|
H.append(f"""<option value="{version}">{description}</option>""")
|
2021-06-14 00:23:22 +02:00
|
|
|
|
|
|
|
H.append("""</select> <input type="submit" value="Générer"/>""")
|
|
|
|
if choose_mail:
|
|
|
|
H.append(
|
2022-10-03 09:46:33 +02:00
|
|
|
"""<div>
|
|
|
|
<input type="checkbox" name="prefer_mail_perso" value="1"
|
|
|
|
/>Utiliser si possible les adresses personnelles
|
|
|
|
</div>"""
|
2021-06-14 00:23:22 +02:00
|
|
|
)
|
|
|
|
|
2022-10-03 09:46:33 +02:00
|
|
|
H.append(f"""<p class="help">{explanation}</p>""")
|
2021-06-14 00:23:22 +02:00
|
|
|
|
2021-07-29 10:19:00 +02:00
|
|
|
return "\n".join(H) + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre_bulletins_mailetuds")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-05-31 00:14:15 +02:00
|
|
|
def formsemestre_bulletins_mailetuds(
|
|
|
|
formsemestre_id,
|
|
|
|
version="long",
|
|
|
|
dialog_confirmed=False,
|
|
|
|
prefer_mail_perso=0,
|
|
|
|
):
|
2022-10-03 09:46:33 +02:00
|
|
|
"""Envoie à chaque etudiant son bulletin
|
|
|
|
(inscrit non démissionnaire ni défaillant et ayant un mail renseigné dans ScoDoc)
|
|
|
|
"""
|
2021-05-31 00:14:15 +02:00
|
|
|
prefer_mail_perso = int(prefer_mail_perso)
|
2023-03-20 11:17:38 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2022-10-03 09:46:33 +02:00
|
|
|
inscriptions = [
|
|
|
|
inscription
|
|
|
|
for inscription in formsemestre.inscriptions
|
|
|
|
if inscription.etat == scu.INSCRIT
|
|
|
|
]
|
2021-05-31 00:14:15 +02:00
|
|
|
#
|
2021-08-20 10:51:42 +02:00
|
|
|
if not sco_bulletins.can_send_bulletin_by_mail(formsemestre_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
raise AccessDenied("vous n'avez pas le droit d'envoyer les bulletins")
|
|
|
|
# Confirmation dialog
|
|
|
|
if not dialog_confirmed:
|
2021-06-02 22:40:34 +02:00
|
|
|
return scu.confirm_dialog(
|
2022-10-03 09:46:33 +02:00
|
|
|
f"<h2>Envoyer les {len(inscriptions)} bulletins par e-mail aux étudiants inscrits ?",
|
2021-05-31 00:14:15 +02:00
|
|
|
dest_url="",
|
2022-10-03 09:46:33 +02:00
|
|
|
cancel_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
),
|
2021-05-31 00:14:15 +02:00
|
|
|
parameters={
|
|
|
|
"version": version,
|
|
|
|
"formsemestre_id": formsemestre_id,
|
|
|
|
"prefer_mail_perso": prefer_mail_perso,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# Make each bulletin
|
2022-03-22 19:18:25 +01:00
|
|
|
nb_sent = 0
|
2022-10-03 09:46:33 +02:00
|
|
|
for inscription in inscriptions:
|
2022-03-22 19:18:25 +01:00
|
|
|
sent, _ = sco_bulletins.do_formsemestre_bulletinetud(
|
2022-02-14 23:21:42 +01:00
|
|
|
formsemestre,
|
2023-03-18 21:56:08 +01:00
|
|
|
inscription.etud,
|
2021-05-31 00:14:15 +02:00
|
|
|
version=version,
|
|
|
|
prefer_mail_perso=prefer_mail_perso,
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt="pdfmail",
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2022-03-22 19:18:25 +01:00
|
|
|
if sent:
|
|
|
|
nb_sent += 1
|
2021-05-31 00:14:15 +02:00
|
|
|
#
|
2022-10-03 09:46:33 +02:00
|
|
|
return f"""
|
|
|
|
{html_sco_header.sco_header()}
|
|
|
|
<p>{nb_sent} bulletins sur {len(inscriptions)} envoyés par mail !</p>
|
|
|
|
<p><a class="stdlink" href="{url_for('notes.formsemestre_status',
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id)
|
|
|
|
}">continuer</a></p>
|
|
|
|
{html_sco_header.sco_footer()}
|
|
|
|
"""
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
sco_publish(
|
|
|
|
"/external_ue_create_form",
|
|
|
|
sco_ue_external.external_ue_create_form,
|
|
|
|
Permission.ScoView,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/appreciation_add_form", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EnsView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-05-31 00:14:15 +02:00
|
|
|
def appreciation_add_form(
|
|
|
|
etudid=None,
|
|
|
|
formsemestre_id=None,
|
2023-08-29 11:27:24 +02:00
|
|
|
appreciation_id=None, # si id, edit
|
2021-05-31 00:14:15 +02:00
|
|
|
suppress=False, # si true, supress id
|
|
|
|
):
|
|
|
|
"form ajout ou edition d'une appreciation"
|
2023-08-29 11:27:24 +02:00
|
|
|
if appreciation_id: # edit mode
|
|
|
|
appreciation = db.session.get(BulAppreciations, appreciation_id)
|
|
|
|
if appreciation is None:
|
2021-05-31 00:14:15 +02:00
|
|
|
raise ScoValueError("id d'appreciation invalide !")
|
2023-08-29 11:27:24 +02:00
|
|
|
formsemestre_id = appreciation.formsemestre_id
|
|
|
|
etudid = appreciation.etudid
|
|
|
|
etud: Identite = Identite.query.filter_by(
|
|
|
|
id=etudid, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2021-09-28 09:14:04 +02:00
|
|
|
vals = scu.get_request_args()
|
2021-09-27 10:20:10 +02:00
|
|
|
if "edit" in vals:
|
|
|
|
edit = int(vals["edit"])
|
2023-08-29 11:27:24 +02:00
|
|
|
elif appreciation_id:
|
2021-05-31 00:14:15 +02:00
|
|
|
edit = 1
|
|
|
|
else:
|
|
|
|
edit = 0
|
2023-08-29 11:27:24 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
# check custom access permission
|
2023-08-29 11:27:24 +02:00
|
|
|
can_edit_app = formsemestre.est_responsable(current_user) or (
|
2023-09-29 21:17:31 +02:00
|
|
|
current_user.has_permission(Permission.EtudInscrit)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
if not can_edit_app:
|
|
|
|
raise AccessDenied("vous n'avez pas le droit d'ajouter une appreciation")
|
|
|
|
#
|
2023-08-29 11:27:24 +02:00
|
|
|
bul_url = url_for(
|
|
|
|
"notes.formsemestre_bulletinetud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etudid=etudid,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2023-08-29 11:27:24 +02:00
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
if suppress:
|
2023-08-29 11:27:24 +02:00
|
|
|
db.session.delete(appreciation)
|
|
|
|
Scolog.logdb(
|
|
|
|
method="appreciation_suppress",
|
|
|
|
etudid=etudid,
|
|
|
|
)
|
|
|
|
db.session.commit()
|
|
|
|
flash("appréciation supprimée")
|
|
|
|
return flask.redirect(bul_url)
|
2021-05-31 00:14:15 +02:00
|
|
|
#
|
2023-08-29 11:27:24 +02:00
|
|
|
if appreciation_id:
|
|
|
|
action = "Édition"
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
2023-08-29 11:27:24 +02:00
|
|
|
action = "Ajout"
|
2021-05-31 00:14:15 +02:00
|
|
|
H = [
|
2023-08-29 11:27:24 +02:00
|
|
|
html_sco_header.sco_header(),
|
|
|
|
f"""<h2>{action} d'une appréciation sur {etud.nomprenom}</h2>""",
|
2021-05-31 00:14:15 +02:00
|
|
|
]
|
2021-07-29 10:19:00 +02:00
|
|
|
F = html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
descr = [
|
|
|
|
("edit", {"input_type": "hidden", "default": edit}),
|
|
|
|
("etudid", {"input_type": "hidden"}),
|
|
|
|
("formsemestre_id", {"input_type": "hidden"}),
|
2023-08-29 11:27:24 +02:00
|
|
|
("appreciation_id", {"input_type": "hidden"}),
|
2021-05-31 00:14:15 +02:00
|
|
|
("comment", {"title": "", "input_type": "textarea", "rows": 4, "cols": 60}),
|
|
|
|
]
|
2023-08-29 11:27:24 +02:00
|
|
|
if appreciation_id:
|
2021-05-31 00:14:15 +02:00
|
|
|
initvalues = {
|
|
|
|
"etudid": etudid,
|
|
|
|
"formsemestre_id": formsemestre_id,
|
2023-08-29 11:27:24 +02:00
|
|
|
"comment": appreciation.comment,
|
2021-05-31 00:14:15 +02:00
|
|
|
}
|
|
|
|
else:
|
|
|
|
initvalues = {}
|
|
|
|
tf = TrivialFormulator(
|
2021-09-18 10:10:02 +02:00
|
|
|
request.base_url,
|
2021-09-27 16:42:14 +02:00
|
|
|
scu.get_request_args(),
|
2021-05-31 00:14:15 +02:00
|
|
|
descr,
|
|
|
|
initvalues=initvalues,
|
|
|
|
cancelbutton="Annuler",
|
|
|
|
submitlabel="Ajouter appréciation",
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
|
|
|
return "\n".join(H) + "\n" + tf[1] + F
|
|
|
|
elif tf[0] == -1:
|
2023-08-29 11:27:24 +02:00
|
|
|
return flask.redirect(bul_url)
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
|
|
|
if edit:
|
2023-08-29 11:27:24 +02:00
|
|
|
appreciation.author = (current_user.user_name,)
|
|
|
|
appreciation.comment = tf[2]["comment"].strip()
|
|
|
|
flash("appréciation modifiée")
|
2021-05-31 00:14:15 +02:00
|
|
|
else: # nouvelle
|
2023-08-29 11:27:24 +02:00
|
|
|
appreciation = BulAppreciations(
|
|
|
|
etudid=etudid,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
author=current_user.user_name,
|
|
|
|
comment=tf[2]["comment"].strip(),
|
|
|
|
)
|
|
|
|
flash("appréciation ajoutée")
|
|
|
|
db.session.add(appreciation)
|
2021-05-31 00:14:15 +02:00
|
|
|
# log
|
2023-08-29 11:27:24 +02:00
|
|
|
Scolog.logdb(
|
2021-05-31 00:14:15 +02:00
|
|
|
method="appreciation_add",
|
|
|
|
etudid=etudid,
|
2023-08-29 11:27:24 +02:00
|
|
|
msg=appreciation.comment_safe(),
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2023-08-29 11:27:24 +02:00
|
|
|
db.session.commit()
|
2021-05-31 00:14:15 +02:00
|
|
|
# ennuyeux mais necessaire (pour le PDF seulement)
|
2021-07-19 19:53:01 +02:00
|
|
|
sco_cache.invalidate_formsemestre(
|
|
|
|
pdfonly=True, formsemestre_id=formsemestre_id
|
2021-05-31 00:14:15 +02:00
|
|
|
) # > appreciation_add
|
2023-08-29 11:27:24 +02:00
|
|
|
return flask.redirect(bul_url)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
# --- FORMULAIRE POUR VALIDATION DES UE ET SEMESTRES
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre_validation_etud_form")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-05-31 00:14:15 +02:00
|
|
|
def formsemestre_validation_etud_form(
|
|
|
|
formsemestre_id,
|
|
|
|
etudid=None,
|
|
|
|
etud_index=None,
|
|
|
|
check=0,
|
|
|
|
desturl="",
|
|
|
|
sortcol=None,
|
|
|
|
):
|
|
|
|
"Formulaire choix jury pour un étudiant"
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
read_only = not formsemestre.can_edit_jury()
|
2022-07-06 00:19:02 +02:00
|
|
|
if formsemestre.formation.is_apc():
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_validation_but",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etudid=etudid,
|
|
|
|
)
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
return sco_formsemestre_validation.formsemestre_validation_etud_form(
|
|
|
|
formsemestre_id,
|
|
|
|
etudid=etudid,
|
|
|
|
etud_index=etud_index,
|
|
|
|
check=check,
|
2023-02-12 01:13:43 +01:00
|
|
|
read_only=read_only,
|
|
|
|
dest_url=desturl,
|
2021-05-31 00:14:15 +02:00
|
|
|
sortcol=sortcol,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre_validation_etud")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-05-31 00:14:15 +02:00
|
|
|
def formsemestre_validation_etud(
|
|
|
|
formsemestre_id,
|
|
|
|
etudid=None,
|
|
|
|
codechoice=None,
|
|
|
|
desturl="",
|
|
|
|
sortcol=None,
|
|
|
|
):
|
|
|
|
"Enregistre choix jury pour un étudiant"
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
return sco_formsemestre_validation.formsemestre_validation_etud(
|
|
|
|
formsemestre_id,
|
|
|
|
etudid=etudid,
|
|
|
|
codechoice=codechoice,
|
|
|
|
desturl=desturl,
|
|
|
|
sortcol=sortcol,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre_validation_etud_manu")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-05-31 00:14:15 +02:00
|
|
|
def formsemestre_validation_etud_manu(
|
|
|
|
formsemestre_id,
|
|
|
|
etudid=None,
|
|
|
|
code_etat="",
|
|
|
|
new_code_prev="",
|
|
|
|
devenir="",
|
|
|
|
assidu=False,
|
|
|
|
desturl="",
|
|
|
|
sortcol=None,
|
|
|
|
):
|
|
|
|
"Enregistre choix jury pour un étudiant"
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
return sco_formsemestre_validation.formsemestre_validation_etud_manu(
|
|
|
|
formsemestre_id,
|
|
|
|
etudid=etudid,
|
|
|
|
code_etat=code_etat,
|
|
|
|
new_code_prev=new_code_prev,
|
|
|
|
devenir=devenir,
|
|
|
|
assidu=assidu,
|
|
|
|
desturl=desturl,
|
|
|
|
sortcol=sortcol,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-06-20 17:56:27 +02:00
|
|
|
# --- Jurys BUT
|
|
|
|
@bp.route(
|
2022-06-29 16:30:01 +02:00
|
|
|
"/formsemestre_validation_but/<int:formsemestre_id>/<etudid>",
|
2022-06-20 17:56:27 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
2022-06-29 16:30:01 +02:00
|
|
|
def formsemestre_validation_but(
|
|
|
|
formsemestre_id: int,
|
|
|
|
etudid: int,
|
|
|
|
):
|
2022-06-20 17:56:27 +02:00
|
|
|
"Form. saisie décision jury semestre BUT"
|
2022-10-03 19:13:15 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.filter_by(
|
|
|
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2022-06-29 16:30:01 +02:00
|
|
|
# la route ne donne pas le type d'etudid pour pouvoir construire des URLs
|
|
|
|
# provisoires avec NEXT et PREV
|
|
|
|
try:
|
|
|
|
etudid = int(etudid)
|
2023-07-06 09:57:51 +02:00
|
|
|
except ValueError as exc:
|
|
|
|
raise ScoValueError("adresse invalide") from exc
|
|
|
|
etud = Identite.get_etud(etudid)
|
|
|
|
nb_etuds = formsemestre.etuds.count()
|
2023-02-12 01:13:43 +01:00
|
|
|
read_only = not formsemestre.can_edit_jury()
|
2022-06-29 16:30:01 +02:00
|
|
|
|
2022-10-03 19:13:15 +02:00
|
|
|
# --- Navigation
|
2023-01-23 22:11:24 +01:00
|
|
|
prev_lnk = (
|
|
|
|
f"""{scu.EMO_PREV_ARROW} <a href="{url_for(
|
2022-10-03 19:13:15 +02:00
|
|
|
"notes.formsemestre_validation_but", scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id, etudid="PREV"
|
|
|
|
)}" class="stdlink"">précédent</a>
|
|
|
|
"""
|
2023-01-23 22:11:24 +01:00
|
|
|
if nb_etuds > 1
|
|
|
|
else ""
|
|
|
|
)
|
|
|
|
next_lnk = (
|
|
|
|
f"""<a href="{url_for(
|
2022-10-03 19:13:15 +02:00
|
|
|
"notes.formsemestre_validation_but", scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id, etudid="NEXT"
|
|
|
|
)}" class="stdlink"">suivant</a> {scu.EMO_NEXT_ARROW}
|
|
|
|
"""
|
2023-01-23 22:11:24 +01:00
|
|
|
if nb_etuds > 1
|
|
|
|
else ""
|
|
|
|
)
|
2022-10-03 19:13:15 +02:00
|
|
|
navigation_div = f"""
|
|
|
|
<div class="but_navigation">
|
|
|
|
<div class="prev">
|
2023-01-08 19:36:05 +01:00
|
|
|
{prev_lnk}
|
2022-10-03 19:13:15 +02:00
|
|
|
</div>
|
|
|
|
<div class="back_list">
|
2023-02-12 01:13:43 +01:00
|
|
|
<a href="{
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_recapcomplet",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
mode_jury=1,
|
|
|
|
selected_etudid=etud.id
|
2022-10-03 19:13:15 +02:00
|
|
|
)}" class="stdlink">retour à la liste</a>
|
|
|
|
</div>
|
|
|
|
<div class="next">
|
2023-01-08 19:36:05 +01:00
|
|
|
{next_lnk}
|
2022-10-03 19:13:15 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
|
2022-06-20 17:56:27 +02:00
|
|
|
H = [
|
|
|
|
html_sco_header.sco_header(
|
2023-01-08 19:36:05 +01:00
|
|
|
page_title=f"Validation BUT S{formsemestre.semestre_id}",
|
2022-06-21 18:33:43 +02:00
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etudid=etudid,
|
2023-06-23 15:35:52 +02:00
|
|
|
cssstyles=[
|
|
|
|
"css/jury_but.css",
|
|
|
|
"css/cursus_but.css",
|
|
|
|
],
|
2022-06-21 18:33:43 +02:00
|
|
|
javascripts=("js/jury_but.js",),
|
2022-06-20 17:56:27 +02:00
|
|
|
),
|
2023-01-08 19:36:05 +01:00
|
|
|
"""<div class="jury_but">
|
2022-06-20 17:56:27 +02:00
|
|
|
""",
|
|
|
|
]
|
2022-06-22 11:44:03 +02:00
|
|
|
|
2022-06-26 21:17:56 +02:00
|
|
|
if formsemestre.etuds_inscriptions[etudid].etat != scu.INSCRIT:
|
2022-06-26 17:02:18 +02:00
|
|
|
return (
|
|
|
|
"\n".join(H)
|
2022-10-03 19:13:15 +02:00
|
|
|
+ f"""
|
|
|
|
<div>
|
|
|
|
<div class="bull_head">
|
|
|
|
<div>
|
|
|
|
<div class="titre_parcours">Jury BUT</div>
|
|
|
|
<div class="nom_etud">{etud.nomprenom}</div>
|
|
|
|
</div>
|
|
|
|
<div class="bull_photo"><a href="{
|
|
|
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id)
|
|
|
|
}">{etud.photo_html(title="fiche de " + etud.nomprenom)}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="warning">Impossible de statuer sur cet étudiant:
|
|
|
|
il est démissionnaire ou défaillant (voir <a class="stdlink" href="{
|
|
|
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
|
|
|
}">sa fiche</a>)
|
|
|
|
</div>
|
2022-06-26 17:02:18 +02:00
|
|
|
</div>
|
2022-10-03 19:13:15 +02:00
|
|
|
{navigation_div}
|
2022-06-26 17:02:18 +02:00
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
+ html_sco_header.sco_footer()
|
|
|
|
)
|
|
|
|
|
2022-06-21 11:21:41 +02:00
|
|
|
deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre)
|
2023-06-28 21:25:38 +02:00
|
|
|
if len(deca.get_decisions_rcues_annee()) == 0:
|
2022-11-01 22:51:50 +01:00
|
|
|
return jury_but_view.jury_but_semestriel(
|
|
|
|
formsemestre, etud, read_only, navigation_div=navigation_div
|
|
|
|
)
|
2022-06-22 11:44:03 +02:00
|
|
|
if request.method == "POST":
|
2022-06-29 16:30:01 +02:00
|
|
|
if not read_only:
|
|
|
|
deca.record_form(request.form)
|
2023-06-23 10:37:32 +02:00
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_JURY,
|
|
|
|
obj=formsemestre.id,
|
|
|
|
text=f"""Saisie décision jury dans {formsemestre.html_link_status()}""",
|
|
|
|
url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
),
|
|
|
|
)
|
2022-06-29 16:30:01 +02:00
|
|
|
flash("codes enregistrés")
|
2022-06-22 11:44:03 +02:00
|
|
|
return flask.redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_validation_but",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etudid=etudid,
|
|
|
|
)
|
|
|
|
)
|
2022-06-29 18:16:37 +02:00
|
|
|
|
2022-06-26 16:08:28 +02:00
|
|
|
warning = ""
|
|
|
|
if len(deca.niveaux_competences) != len(deca.decisions_rcue_by_niveau):
|
2023-06-28 21:25:38 +02:00
|
|
|
warning += f"""<div class="warning">Attention: {len(deca.niveaux_competences)}
|
2022-12-24 22:06:22 +01:00
|
|
|
niveaux mais {len(deca.decisions_rcue_by_niveau)} regroupements RCUE.</div>"""
|
|
|
|
if (deca.parcour is None) and len(formsemestre.parcours) > 0:
|
|
|
|
warning += (
|
|
|
|
"""<div class="warning">L'étudiant n'est pas inscrit à un parcours.</div>"""
|
|
|
|
)
|
2023-06-28 21:25:38 +02:00
|
|
|
|
|
|
|
if deca.formsemestre_impair:
|
|
|
|
inscription = deca.formsemestre_impair.etuds_inscriptions.get(etud.id)
|
|
|
|
if (not inscription) or inscription.etat != scu.INSCRIT:
|
|
|
|
etat_ins = scu.ETATS_INSCRIPTION.get(inscription.etat, "inconnu?")
|
|
|
|
warning += f"""<div class="warning">{etat_ins} en S{deca.formsemestre_impair.semestre_id}</div>"""
|
|
|
|
|
|
|
|
if deca.formsemestre_pair:
|
|
|
|
inscription = deca.formsemestre_pair.etuds_inscriptions.get(etud.id)
|
|
|
|
if (not inscription) or inscription.etat != scu.INSCRIT:
|
|
|
|
etat_ins = scu.ETATS_INSCRIPTION.get(inscription.etat, "inconnu?")
|
|
|
|
warning += f"""<div class="warning">{etat_ins} en S{deca.formsemestre_pair.semestre_id}</div>"""
|
|
|
|
|
2023-02-10 23:43:16 +01:00
|
|
|
if deca.has_notes_en_attente():
|
|
|
|
warning += f"""<div class="warning">{etud.nomprenom} a des notes en ATTente.
|
|
|
|
Vous devriez régler cela avant de statuer en jury !</div>"""
|
2022-06-21 11:21:41 +02:00
|
|
|
H.append(
|
|
|
|
f"""
|
2022-06-24 04:16:31 +02:00
|
|
|
<div>
|
2022-06-29 19:54:22 +02:00
|
|
|
<div class="bull_head">
|
|
|
|
<div>
|
|
|
|
<div class="titre_parcours">Jury BUT{deca.annee_but}
|
|
|
|
- Parcours {(deca.parcour.libelle if deca.parcour else False) or "non spécifié"}
|
|
|
|
- {deca.annee_scolaire_str()}</div>
|
|
|
|
<div class="nom_etud">{etud.nomprenom}</div>
|
|
|
|
</div>
|
|
|
|
<div class="bull_photo"><a href="{
|
|
|
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id)
|
|
|
|
}">{etud.photo_html(title="fiche de " + etud.nomprenom)}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{warning}
|
2022-06-21 18:33:43 +02:00
|
|
|
</div>
|
2022-09-30 16:20:51 +02:00
|
|
|
|
2023-06-23 15:35:52 +02:00
|
|
|
<form method="post" class="jury_but_box" id="jury_but">
|
2022-06-21 11:21:41 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
|
2022-06-29 18:16:37 +02:00
|
|
|
H.append(jury_but_view.show_etud(deca, read_only=read_only))
|
2022-06-21 11:21:41 +02:00
|
|
|
|
2023-01-26 14:49:04 +01:00
|
|
|
autorisations_idx = deca.get_autorisations_passage()
|
|
|
|
div_autorisations_passage = (
|
|
|
|
f"""
|
|
|
|
<div class="but_autorisations_passage">
|
|
|
|
<span>Autorisé à passer en :</span>
|
|
|
|
{ ", ".join( ["S" + str(i) for i in autorisations_idx ] )}
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
if autorisations_idx
|
2023-01-26 16:35:15 +01:00
|
|
|
else """<div class="but_autorisations_passage but_explanation">
|
|
|
|
pas d'autorisations de passage enregistrées.
|
|
|
|
</div>
|
|
|
|
"""
|
2023-01-26 14:49:04 +01:00
|
|
|
)
|
|
|
|
H.append(div_autorisations_passage)
|
|
|
|
|
2022-06-29 16:30:01 +02:00
|
|
|
if read_only:
|
|
|
|
H.append(
|
2023-01-26 16:35:15 +01:00
|
|
|
f"""
|
2023-01-26 14:49:04 +01:00
|
|
|
<div class="but_explanation">
|
2023-01-26 16:35:15 +01:00
|
|
|
{"Vous n'avez pas la permission de modifier ces décisions."
|
|
|
|
if formsemestre.etat
|
|
|
|
else "Semestre verrouillé."}
|
2023-01-26 14:49:04 +01:00
|
|
|
Les champs entourés en vert sont enregistrés.
|
|
|
|
</div>"""
|
2022-06-29 16:30:01 +02:00
|
|
|
)
|
|
|
|
else:
|
2023-06-30 17:26:41 +02:00
|
|
|
erase_span = f"""
|
2023-06-18 09:37:13 +02:00
|
|
|
<a style="margin-left: 16px;" class="stdlink"
|
|
|
|
href="{
|
|
|
|
url_for("notes.erase_decisions_annee_formation",
|
|
|
|
scodoc_dept=g.scodoc_dept, formation_id=deca.formsemestre.formation.id,
|
2023-06-30 17:26:41 +02:00
|
|
|
etudid=deca.etud.id, annee=deca.annee_but, formsemestre_id=formsemestre_id)}"
|
|
|
|
>effacer des décisions de jury</a>
|
|
|
|
|
|
|
|
<a style="margin-left: 16px;" class="stdlink"
|
|
|
|
href="{
|
|
|
|
url_for("notes.formsemestre_validate_previous_ue",
|
2023-12-06 20:04:40 +01:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
2023-06-30 17:26:41 +02:00
|
|
|
etudid=deca.etud.id, formsemestre_id=formsemestre_id)}"
|
|
|
|
>enregistrer des UEs antérieures</a>
|
2023-06-18 09:37:13 +02:00
|
|
|
"""
|
2022-06-29 16:30:01 +02:00
|
|
|
H.append(
|
|
|
|
f"""<div class="but_settings">
|
|
|
|
<input type="checkbox" onchange="enable_manual_codes(this)">
|
2023-01-26 14:49:04 +01:00
|
|
|
<em>permettre la saisie manuelles des codes
|
|
|
|
{"d'année et " if deca.jury_annuel else ""}
|
|
|
|
de niveaux.
|
|
|
|
Dans ce cas, assurez-vous de la cohérence entre les codes d'UE/RCUE/Année !
|
|
|
|
</em>
|
2022-06-29 16:30:01 +02:00
|
|
|
</input>
|
|
|
|
</div>
|
2022-10-04 21:56:10 +02:00
|
|
|
|
2022-06-29 16:30:01 +02:00
|
|
|
<div class="but_buttons">
|
2023-01-08 19:36:05 +01:00
|
|
|
<span><input type="submit" value="Enregistrer ces décisions"></span>
|
|
|
|
<span>{erase_span}</span>
|
2022-06-29 16:30:01 +02:00
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
)
|
2022-10-03 19:13:15 +02:00
|
|
|
H.append(navigation_div)
|
2022-06-29 18:16:37 +02:00
|
|
|
H.append("</form>")
|
2023-06-28 21:25:38 +02:00
|
|
|
|
2023-06-23 15:35:52 +02:00
|
|
|
# Affichage cursus BUT
|
|
|
|
but_cursus = cursus_but.EtudCursusBUT(etud, deca.formsemestre.formation)
|
|
|
|
H += [
|
|
|
|
"""<div class="jury_but_box">
|
|
|
|
<div class="jury_but_box_title"><b>Niveaux de compétences enregistrés :</b></div>
|
|
|
|
""",
|
|
|
|
render_template(
|
|
|
|
"but/cursus_etud.j2",
|
|
|
|
cursus=but_cursus,
|
|
|
|
scu=scu,
|
|
|
|
),
|
|
|
|
"</div>",
|
|
|
|
]
|
2022-06-26 15:43:46 +02:00
|
|
|
H.append(
|
|
|
|
render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"but/documentation_codes_jury.j2",
|
2022-06-26 15:43:46 +02:00
|
|
|
nom_univ=f"""Export {sco_preferences.get_preference("InstituteName")
|
|
|
|
or sco_preferences.get_preference("UnivName")
|
|
|
|
or "Apogée"}""",
|
|
|
|
codes=ScoDocSiteConfig.get_codes_apo_dict(),
|
|
|
|
)
|
|
|
|
)
|
2023-06-28 21:25:38 +02:00
|
|
|
H.append(
|
|
|
|
f"""<div class="but_doc_codes but_warning_rcue_cap">
|
|
|
|
{scu.EMO_WARNING} Rappel: pour les redoublants, seules les UE <b>capitalisées</b> (note > 10)
|
|
|
|
lors d'une année précédente peuvent être prise en compte pour former
|
|
|
|
un RCUE (associé à un niveau de compétence du BUT).
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
)
|
2022-06-21 11:21:41 +02:00
|
|
|
return "\n".join(H) + html_sco_header.sco_footer()
|
2022-06-20 17:56:27 +02:00
|
|
|
|
|
|
|
|
2022-06-25 02:59:43 +02:00
|
|
|
@bp.route(
|
|
|
|
"/formsemestre_validation_auto_but/<int:formsemestre_id>", methods=["GET", "POST"]
|
|
|
|
)
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
def formsemestre_validation_auto_but(formsemestre_id: int = None):
|
|
|
|
"Saisie automatique des décisions de jury BUT"
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
2022-06-25 02:59:43 +02:00
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
2023-02-12 01:13:43 +01:00
|
|
|
)
|
2022-06-25 02:59:43 +02:00
|
|
|
)
|
2023-02-12 01:13:43 +01:00
|
|
|
|
2023-03-20 11:17:38 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2022-06-25 02:59:43 +02:00
|
|
|
form = jury_but_forms.FormSemestreValidationAutoBUTForm()
|
|
|
|
if request.method == "POST":
|
|
|
|
if not form.cancel.data:
|
2023-01-23 11:38:47 +01:00
|
|
|
nb_etud_modif = jury_but_validation_auto.formsemestre_validation_auto_but(
|
2022-06-25 02:59:43 +02:00
|
|
|
formsemestre
|
|
|
|
)
|
2023-01-23 11:38:47 +01:00
|
|
|
flash(f"Décisions enregistrées ({nb_etud_modif} étudiants modifiés)")
|
2022-06-25 02:59:43 +02:00
|
|
|
return redirect(
|
|
|
|
url_for(
|
2023-02-12 01:13:43 +01:00
|
|
|
"notes.formsemestre_recapcomplet",
|
2022-06-25 02:59:43 +02:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
2023-02-12 01:13:43 +01:00
|
|
|
mode_jury=1,
|
2022-06-25 02:59:43 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"but/formsemestre_validation_auto_but.j2",
|
2022-06-25 02:59:43 +02:00
|
|
|
form=form,
|
|
|
|
sco=ScoData(formsemestre=formsemestre),
|
2023-01-23 11:38:47 +01:00
|
|
|
title="Calcul automatique jury BUT",
|
2022-06-25 02:59:43 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
@bp.route(
|
|
|
|
"/formsemestre_validate_previous_ue/<int:formsemestre_id>/<int:etudid>",
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_validate_previous_ue(formsemestre_id, etudid=None):
|
2021-08-07 08:42:57 +02:00
|
|
|
"Form. saisie UE validée hors ScoDoc"
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2023-06-25 11:49:11 +02:00
|
|
|
etud: Identite = (
|
|
|
|
Identite.query.filter_by(id=etudid)
|
|
|
|
.join(FormSemestreInscription)
|
|
|
|
.filter_by(formsemestre_id=formsemestre_id)
|
|
|
|
.first_or_404()
|
|
|
|
)
|
2023-02-12 01:13:43 +01:00
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
return sco_formsemestre_validation.formsemestre_validate_previous_ue(
|
2023-06-25 11:49:11 +02:00
|
|
|
formsemestre, etud
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_ext_create_form",
|
|
|
|
sco_formsemestre_exterieurs.formsemestre_ext_create_form,
|
|
|
|
Permission.ScoView,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-06-25 19:24:12 +02:00
|
|
|
@bp.route("/formsemestre_ext_edit_ue_validations", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid=None):
|
2021-05-31 00:14:15 +02:00
|
|
|
"Form. edition UE semestre extérieur"
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2023-02-12 01:13:43 +01:00
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
return sco_formsemestre_exterieurs.formsemestre_ext_edit_ue_validations(
|
2021-09-27 10:20:10 +02:00
|
|
|
formsemestre_id, etudid
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre_validation_auto")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_validation_auto(formsemestre_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"Formulaire saisie automatisee des decisions d'un semestre"
|
2023-01-23 11:38:47 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.filter_by(
|
|
|
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2023-02-12 01:13:43 +01:00
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-01-23 11:38:47 +01:00
|
|
|
if formsemestre.formation.is_apc():
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_validation_auto_but",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
)
|
|
|
|
)
|
2021-09-27 10:20:10 +02:00
|
|
|
return sco_formsemestre_validation.formsemestre_validation_auto(formsemestre_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/do_formsemestre_validation_auto")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def do_formsemestre_validation_auto(formsemestre_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"Formulaire saisie automatisee des decisions d'un semestre"
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
return sco_formsemestre_validation.do_formsemestre_validation_auto(formsemestre_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
2021-07-13 09:38:31 +02:00
|
|
|
@bp.route("/formsemestre_validation_suppress_etud", methods=["GET", "POST"])
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-05-31 00:14:15 +02:00
|
|
|
def formsemestre_validation_suppress_etud(
|
2021-09-27 10:20:10 +02:00
|
|
|
formsemestre_id, etudid, dialog_confirmed=False
|
2021-05-31 00:14:15 +02:00
|
|
|
):
|
2022-07-06 00:05:14 +02:00
|
|
|
"""Suppression des décisions de jury pour un étudiant."""
|
2023-02-12 01:13:43 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2023-03-20 11:17:38 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
2022-07-06 00:05:14 +02:00
|
|
|
if formsemestre.formation.is_apc():
|
|
|
|
next_url = url_for(
|
|
|
|
"scolar.ficheEtud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
etudid=etudid,
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
next_url = url_for(
|
|
|
|
"notes.formsemestre_validation_etud_form",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etudid=etudid,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
if not dialog_confirmed:
|
2022-07-06 00:05:14 +02:00
|
|
|
d = sco_bulletins_json.dict_decision_jury(
|
2022-07-08 18:09:45 +02:00
|
|
|
etud, formsemestre, with_decisions=True
|
2022-07-06 00:05:14 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
descr_ues = [f"{u['acronyme']}: {u['code']}" for u in d.get("decision_ue", [])]
|
|
|
|
dec_annee = d.get("decision_annee")
|
|
|
|
if dec_annee:
|
|
|
|
descr_annee = dec_annee.get("code", "-")
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
2022-07-06 00:05:14 +02:00
|
|
|
descr_annee = "-"
|
|
|
|
|
|
|
|
existing = f"""
|
|
|
|
<ul>
|
|
|
|
<li>Semestre : {d.get("decision", {"code":"-"})['code'] or "-"}</li>
|
|
|
|
<li>Année BUT: {descr_annee}</li>
|
|
|
|
<li>UEs : {", ".join(descr_ues)}</li>
|
|
|
|
<li>RCUEs: {len(d.get("decision_rcue", []))} décisions</li>
|
2023-02-27 17:45:20 +01:00
|
|
|
<li>Autorisations: {descr_autorisations(ScolarAutorisationInscription.query.filter_by(origin_formsemestre_id=formsemestre_id,
|
|
|
|
etudid=etudid))}
|
2022-07-06 00:05:14 +02:00
|
|
|
</ul>
|
|
|
|
"""
|
2021-06-02 22:40:34 +02:00
|
|
|
return scu.confirm_dialog(
|
2022-07-06 00:05:14 +02:00
|
|
|
f"""<h2>Confirmer la suppression des décisions du semestre
|
|
|
|
{formsemestre.titre_mois()} pour {etud.nomprenom}
|
|
|
|
</h2>
|
|
|
|
<p>Cette opération est irréversible.</p>
|
|
|
|
<div>
|
|
|
|
{existing}
|
|
|
|
</div>
|
|
|
|
""",
|
2021-05-31 00:14:15 +02:00
|
|
|
OK="Supprimer",
|
|
|
|
dest_url="",
|
2022-07-06 00:05:14 +02:00
|
|
|
cancel_url=next_url,
|
2021-05-31 00:14:15 +02:00
|
|
|
parameters={"etudid": etudid, "formsemestre_id": formsemestre_id},
|
|
|
|
)
|
|
|
|
|
|
|
|
sco_formsemestre_validation.formsemestre_validation_suppress_etud(
|
2021-08-21 00:24:51 +02:00
|
|
|
formsemestre_id, etudid
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
2022-07-06 00:05:14 +02:00
|
|
|
flash("Décisions supprimées")
|
|
|
|
return flask.redirect(next_url)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
# ------------- PV de JURY et archives
|
2023-02-19 15:45:27 +01:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_pvjury", sco_pv_forms.formsemestre_pvjury, Permission.ScoView
|
|
|
|
)
|
2022-06-23 06:33:03 +02:00
|
|
|
|
2023-02-18 18:49:52 +01:00
|
|
|
sco_publish("/pvjury_page_but", jury_but_pv.pvjury_page_but, Permission.ScoView)
|
2022-06-30 23:49:39 +02:00
|
|
|
|
2022-06-23 06:33:03 +02:00
|
|
|
|
|
|
|
@bp.route("/formsemestre_saisie_jury")
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
@scodoc7func
|
2022-06-24 07:28:27 +02:00
|
|
|
def formsemestre_saisie_jury(formsemestre_id: int, selected_etudid: int = None):
|
2022-06-23 06:33:03 +02:00
|
|
|
"""Page de saisie: liste des étudiants et lien vers page jury
|
|
|
|
sinon, redirect vers page recap en mode jury
|
|
|
|
"""
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_recapcomplet",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
2022-06-29 16:30:01 +02:00
|
|
|
mode_jury=1,
|
2022-06-23 06:33:03 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-01-30 19:30:25 +01:00
|
|
|
@bp.route(
|
|
|
|
"/formsemestre_jury_but_erase/<int:formsemestre_id>",
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
defaults={"etudid": None},
|
|
|
|
)
|
2022-06-25 14:18:34 +02:00
|
|
|
@bp.route(
|
|
|
|
"/formsemestre_jury_but_erase/<int:formsemestre_id>/<int:etudid>",
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
2023-06-18 09:37:13 +02:00
|
|
|
def formsemestre_jury_but_erase(formsemestre_id: int, etudid: int = None):
|
2022-09-30 16:20:51 +02:00
|
|
|
"""Supprime la décision de jury BUT pour cette année.
|
2023-01-30 19:30:25 +01:00
|
|
|
Si l'étudiant n'est pas spécifié, efface les décisions de tous les inscrits.
|
2023-06-18 09:37:13 +02:00
|
|
|
Si only_one_sem, n'efface que pour le formsemestre indiqué, pas les deux de l'année.
|
2022-09-30 16:20:51 +02:00
|
|
|
"""
|
|
|
|
only_one_sem = int(request.args.get("only_one_sem") or False)
|
2023-06-18 09:37:13 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.filter_by(
|
|
|
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2023-02-12 01:13:43 +01:00
|
|
|
if not formsemestre.can_edit_jury():
|
|
|
|
raise ScoPermissionDenied(
|
|
|
|
dest_url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
|
|
|
)
|
2022-06-25 14:18:34 +02:00
|
|
|
if not formsemestre.formation.is_apc():
|
|
|
|
raise ScoValueError("semestre non BUT")
|
2023-01-30 19:30:25 +01:00
|
|
|
if etudid is None:
|
|
|
|
etud = None
|
|
|
|
etuds = formsemestre.get_inscrits(include_demdef=True)
|
|
|
|
dest_url = url_for(
|
2023-02-12 01:13:43 +01:00
|
|
|
"notes.formsemestre_recapcomplet",
|
2023-01-30 19:30:25 +01:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
2023-02-12 01:13:43 +01:00
|
|
|
mode_jury=1,
|
2023-01-30 19:30:25 +01:00
|
|
|
)
|
|
|
|
else:
|
2023-03-20 11:17:38 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
2023-01-30 19:30:25 +01:00
|
|
|
etuds = [etud]
|
|
|
|
dest_url = url_for(
|
|
|
|
"notes.formsemestre_validation_but",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etudid=etudid,
|
|
|
|
)
|
2022-06-25 14:18:34 +02:00
|
|
|
if request.method == "POST":
|
2023-01-30 19:30:25 +01:00
|
|
|
with sco_cache.DeferredSemCacheManager():
|
|
|
|
for etud in etuds:
|
|
|
|
deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre)
|
|
|
|
deca.erase(only_one_sem=only_one_sem)
|
|
|
|
log(f"formsemestre_jury_but_erase({formsemestre_id}, {etudid})")
|
2022-09-30 16:20:51 +02:00
|
|
|
flash(
|
2023-01-30 19:30:25 +01:00
|
|
|
(
|
|
|
|
"décisions de jury du semestre effacées"
|
|
|
|
if only_one_sem
|
|
|
|
else "décisions de jury des semestres de l'année BUT effacées"
|
|
|
|
)
|
|
|
|
+ f" pour {len(etuds)} étudiant{'s' if len(etuds) > 1 else ''}"
|
2022-09-30 16:20:51 +02:00
|
|
|
)
|
2022-06-25 14:18:34 +02:00
|
|
|
return redirect(dest_url)
|
|
|
|
|
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"confirm_dialog.j2",
|
2023-01-30 19:30:25 +01:00
|
|
|
title=f"""Effacer les validations de jury {
|
2023-02-05 18:38:52 +01:00
|
|
|
("de " + etud.nomprenom)
|
2023-01-30 19:30:25 +01:00
|
|
|
if etud
|
|
|
|
else ("des " + str(len(etuds)) + " étudiants inscrits dans ce semestre")
|
|
|
|
} ?""",
|
|
|
|
explanation=(
|
|
|
|
f"""Les validations d'UE et autorisations de passage
|
2022-09-30 16:20:51 +02:00
|
|
|
du semestre S{formsemestre.semestre_id} seront effacées."""
|
2023-01-30 19:30:25 +01:00
|
|
|
if only_one_sem
|
|
|
|
else """Les validations de toutes les UE, RCUE (compétences) et année
|
2023-01-17 23:14:58 +01:00
|
|
|
issues de cette année scolaire seront effacées.
|
2023-01-30 19:30:25 +01:00
|
|
|
"""
|
|
|
|
)
|
2023-06-18 09:37:13 +02:00
|
|
|
+ """
|
|
|
|
<p>Les décisions des années scolaires précédentes ne seront pas modifiées.</p>
|
2023-06-20 21:01:40 +02:00
|
|
|
<p>Efface aussi toutes les validations concernant l'année BUT de ce semestre,
|
|
|
|
même si elles ont été acquises ailleurs.
|
|
|
|
</p>
|
|
|
|
<div class="warning">Cette opération est irréversible !
|
|
|
|
A n'utiliser que dans des cas exceptionnels, vérifiez bien tous les étudiants ensuite.
|
|
|
|
</div>
|
2023-06-18 09:37:13 +02:00
|
|
|
""",
|
2022-06-25 14:18:34 +02:00
|
|
|
cancel_url=dest_url,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-06-18 09:37:13 +02:00
|
|
|
@bp.route(
|
|
|
|
"/erase_decisions_annee_formation/<int:etudid>/<int:formation_id>/<int:annee>",
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2023-06-18 09:37:13 +02:00
|
|
|
def erase_decisions_annee_formation(etudid: int, formation_id: int, annee: int):
|
|
|
|
"""Efface toute les décisions d'une année pour cet étudiant"""
|
|
|
|
etud: Identite = Identite.query.get_or_404(etudid)
|
|
|
|
formation: Formation = Formation.query.filter_by(
|
|
|
|
id=formation_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
|
|
|
if request.method == "POST":
|
|
|
|
jury.erase_decisions_annee_formation(etud, formation, annee, delete=True)
|
|
|
|
flash("Décisions de jury effacées")
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"scolar.ficheEtud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
etudid=etud.id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
validations = jury.erase_decisions_annee_formation(etud, formation, annee)
|
2023-06-30 17:26:41 +02:00
|
|
|
formsemestre_origine_id = request.args.get("formsemestre_id")
|
|
|
|
formsemestre_origine = (
|
|
|
|
FormSemestre.query.get_or_404(formsemestre_origine_id)
|
|
|
|
if formsemestre_origine_id
|
|
|
|
else None
|
|
|
|
)
|
2023-06-18 09:37:13 +02:00
|
|
|
return render_template(
|
|
|
|
"jury/erase_decisions_annee_formation.j2",
|
|
|
|
annee=annee,
|
|
|
|
cancel_url=url_for(
|
|
|
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id
|
|
|
|
),
|
|
|
|
etud=etud,
|
|
|
|
formation=formation,
|
2023-06-30 17:26:41 +02:00
|
|
|
formsemestre_origine=formsemestre_origine,
|
2023-06-18 09:37:13 +02:00
|
|
|
validations=validations,
|
|
|
|
sco=ScoData(),
|
|
|
|
title=f"Effacer décisions de jury {etud.nom} - année {annee}",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-06-19 22:07:31 +02:00
|
|
|
@bp.route(
|
|
|
|
"/jury_delete_manual/<int:etudid>",
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EtudInscrit)
|
2023-06-19 22:07:31 +02:00
|
|
|
def jury_delete_manual(etudid: int):
|
|
|
|
"""Efface toute les décisions d'une année pour cet étudiant"""
|
|
|
|
etud: Identite = Identite.query.get_or_404(etudid)
|
|
|
|
return jury_edit_manual.jury_delete_manual(etud)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_lettres_individuelles",
|
2023-02-19 15:45:27 +01:00
|
|
|
sco_pv_forms.formsemestre_lettres_individuelles,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
2021-07-13 22:07:59 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2023-03-19 10:26:03 +01:00
|
|
|
"/formsemestre_pvjury_pdf",
|
|
|
|
sco_pv_forms.formsemestre_pvjury_pdf,
|
|
|
|
Permission.ScoView,
|
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/feuille_preparation_jury",
|
|
|
|
sco_prepajury.feuille_preparation_jury,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/formsemestre_archive",
|
2023-12-23 13:53:02 +01:00
|
|
|
sco_archives_formsemestre.formsemestre_archive,
|
2021-06-25 19:24:12 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_delete_archive",
|
2023-12-23 13:53:02 +01:00
|
|
|
sco_archives_formsemestre.formsemestre_delete_archive,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
2021-08-22 17:18:15 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_list_archives",
|
2023-12-23 13:53:02 +01:00
|
|
|
sco_archives_formsemestre.formsemestre_list_archives,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_get_archived_file",
|
2023-12-23 13:53:02 +01:00
|
|
|
sco_archives_formsemestre.formsemestre_get_archived_file,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2023-09-29 21:17:31 +02:00
|
|
|
sco_publish("/view_apo_csv", sco_etape_apogee_view.view_apo_csv, Permission.EditApogee)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/view_apo_csv_store",
|
|
|
|
sco_etape_apogee_view.view_apo_csv_store,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-09-21 14:01:46 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/view_apo_csv_download_and_store",
|
|
|
|
sco_etape_apogee_view.view_apo_csv_download_and_store,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-09-21 14:01:46 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/view_apo_csv_delete",
|
|
|
|
sco_etape_apogee_view.view_apo_csv_delete,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-10-09 19:48:55 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2023-09-29 21:17:31 +02:00
|
|
|
"/view_scodoc_etuds", sco_etape_apogee_view.view_scodoc_etuds, Permission.EditApogee
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2023-09-29 21:17:31 +02:00
|
|
|
"/view_apo_etuds", sco_etape_apogee_view.view_apo_etuds, Permission.EditApogee
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/apo_semset_maq_status",
|
|
|
|
sco_etape_apogee_view.apo_semset_maq_status,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/apo_csv_export_results",
|
|
|
|
sco_etape_apogee_view.apo_csv_export_results,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
2022-04-16 15:34:40 +02:00
|
|
|
|
|
|
|
@bp.route("/formsemestre_set_apo_etapes", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditApogee)
|
2022-04-16 15:34:40 +02:00
|
|
|
def formsemestre_set_apo_etapes():
|
|
|
|
"""Change les codes étapes du semestre indiqué.
|
|
|
|
Args: oid=formsemestre_id, value=chaine "V1RT, V1RT2", codes séparés par des virgules
|
|
|
|
"""
|
|
|
|
formsemestre_id = int(request.form.get("oid"))
|
|
|
|
etapes_apo_str = request.form.get("value")
|
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
|
|
|
current_etapes = {e.etape_apo for e in formsemestre.etapes}
|
|
|
|
new_etapes = {s.strip() for s in etapes_apo_str.split(",")}
|
|
|
|
|
|
|
|
if new_etapes != current_etapes:
|
|
|
|
formsemestre.etapes = []
|
|
|
|
for etape_apo in new_etapes:
|
|
|
|
etape = models.FormSemestreEtape(
|
|
|
|
formsemestre_id=formsemestre_id, etape_apo=etape_apo
|
|
|
|
)
|
|
|
|
formsemestre.etapes.append(etape)
|
|
|
|
db.session.add(formsemestre)
|
|
|
|
db.session.commit()
|
2022-04-20 22:55:40 +02:00
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_APO,
|
|
|
|
text=f"Modification code Apogée du semestre {formsemestre.titre_annee()})",
|
|
|
|
)
|
|
|
|
return ("", 204)
|
|
|
|
|
|
|
|
|
2022-04-21 13:59:53 +02:00
|
|
|
@bp.route("/formsemestre_set_elt_annee_apo", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditApogee)
|
2022-04-21 13:59:53 +02:00
|
|
|
def formsemestre_set_elt_annee_apo():
|
|
|
|
"""Change les codes étapes du semestre indiqué.
|
|
|
|
Args: oid=formsemestre_id, value=chaine "V3ONM, V3ONM1, V3ONM2", codes séparés par des virgules
|
|
|
|
"""
|
|
|
|
oid = int(request.form.get("oid"))
|
|
|
|
value = (request.form.get("value") or "").strip()
|
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(oid)
|
|
|
|
if value != formsemestre.elt_annee_apo:
|
|
|
|
formsemestre.elt_annee_apo = value
|
|
|
|
db.session.add(formsemestre)
|
|
|
|
db.session.commit()
|
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_APO,
|
|
|
|
text=f"Modification code Apogée du semestre {formsemestre.titre_annee()})",
|
|
|
|
)
|
|
|
|
return ("", 204)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre_set_elt_sem_apo", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditApogee)
|
2022-04-21 13:59:53 +02:00
|
|
|
def formsemestre_set_elt_sem_apo():
|
|
|
|
"""Change les codes étapes du semestre indiqué.
|
|
|
|
Args: oid=formsemestre_id, value=chaine "V3ONM, V3ONM1, V3ONM2", codes séparés par des virgules
|
|
|
|
"""
|
|
|
|
oid = int(request.form.get("oid"))
|
|
|
|
value = (request.form.get("value") or "").strip()
|
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(oid)
|
|
|
|
if value != formsemestre.elt_sem_apo:
|
|
|
|
formsemestre.elt_sem_apo = value
|
|
|
|
db.session.add(formsemestre)
|
|
|
|
db.session.commit()
|
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_APO,
|
|
|
|
text=f"Modification code Apogée du semestre {formsemestre.titre_annee()})",
|
|
|
|
)
|
|
|
|
return ("", 204)
|
|
|
|
|
|
|
|
|
2022-04-20 22:55:40 +02:00
|
|
|
@bp.route("/ue_set_apo", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditApogee)
|
2022-04-20 22:55:40 +02:00
|
|
|
def ue_set_apo():
|
|
|
|
"""Change le code APO de l'UE
|
|
|
|
Args: oid=ue_id, value=chaine "VRTU12" (1 seul code / UE)
|
|
|
|
"""
|
|
|
|
ue_id = int(request.form.get("oid"))
|
|
|
|
code_apo = (request.form.get("value") or "").strip()
|
|
|
|
ue = UniteEns.query.get_or_404(ue_id)
|
|
|
|
if code_apo != ue.code_apogee:
|
|
|
|
ue.code_apogee = code_apo
|
|
|
|
db.session.add(ue)
|
|
|
|
db.session.commit()
|
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_FORM,
|
|
|
|
text=f"Modification code Apogée d'UE dans la formation {ue.formation.titre} ({ue.formation.acronyme})",
|
|
|
|
)
|
|
|
|
return ("", 204)
|
2022-04-16 15:34:40 +02:00
|
|
|
|
2022-04-20 22:55:40 +02:00
|
|
|
|
|
|
|
@bp.route("/module_set_apo", methods=["POST"])
|
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditApogee)
|
2022-04-20 22:55:40 +02:00
|
|
|
def module_set_apo():
|
|
|
|
"""Change le code APO du module
|
|
|
|
Args: oid=ue_id, value=chaine "VRTU12" (1 seul code / UE)
|
|
|
|
"""
|
|
|
|
oid = int(request.form.get("oid"))
|
|
|
|
code_apo = (request.form.get("value") or "").strip()
|
|
|
|
mod = Module.query.get_or_404(oid)
|
|
|
|
if code_apo != mod.code_apogee:
|
|
|
|
mod.code_apogee = code_apo
|
|
|
|
db.session.add(mod)
|
|
|
|
db.session.commit()
|
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_FORM,
|
2023-06-23 10:37:32 +02:00
|
|
|
text=f"""Modification code Apogée d'UE dans la formation {
|
|
|
|
mod.formation.titre} ({mod.formation.acronyme})""",
|
2022-04-20 22:55:40 +02:00
|
|
|
)
|
2022-04-16 15:34:40 +02:00
|
|
|
return ("", 204)
|
|
|
|
|
|
|
|
|
2021-05-31 00:14:15 +02:00
|
|
|
# sco_semset
|
2023-09-29 21:17:31 +02:00
|
|
|
sco_publish("/semset_page", sco_semset.semset_page, Permission.EditApogee)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/do_semset_create",
|
|
|
|
sco_semset.do_semset_create,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/do_semset_delete",
|
|
|
|
sco_semset.do_semset_delete,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/edit_semset_set_title",
|
|
|
|
sco_semset.edit_semset_set_title,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/do_semset_add_sem",
|
|
|
|
sco_semset.do_semset_add_sem,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/do_semset_remove_sem",
|
|
|
|
sco_semset.do_semset_remove_sem,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# sco_export_result
|
|
|
|
sco_publish(
|
|
|
|
"/scodoc_table_results",
|
|
|
|
sco_export_results.scodoc_table_results,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EditApogee,
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
sco_publish(
|
2021-06-25 19:24:12 +02:00
|
|
|
"/apo_compare_csv_form",
|
|
|
|
sco_apogee_compare.apo_compare_csv_form,
|
|
|
|
Permission.ScoView,
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/apo_compare_csv",
|
|
|
|
sco_apogee_compare.apo_compare_csv,
|
|
|
|
Permission.ScoView,
|
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# ------------- INSCRIPTIONS: PASSAGE D'UN SEMESTRE A UN AUTRE
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_inscr_passage",
|
|
|
|
sco_inscr_passage.formsemestre_inscr_passage,
|
2023-09-29 21:17:31 +02:00
|
|
|
Permission.EtudInscrit,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_synchro_etuds",
|
|
|
|
sco_synchro_etuds.formsemestre_synchro_etuds,
|
|
|
|
Permission.ScoView,
|
2021-06-25 19:24:12 +02:00
|
|
|
methods=["GET", "POST"],
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# ------------- RAPPORTS STATISTIQUES
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_report_counts",
|
|
|
|
sco_report.formsemestre_report_counts,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_suivi_cohorte",
|
|
|
|
sco_report.formsemestre_suivi_cohorte,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
2023-02-12 13:36:47 +01:00
|
|
|
"/formsemestre_suivi_cursus",
|
|
|
|
sco_report.formsemestre_suivi_cursus,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_etuds_lycees",
|
|
|
|
sco_lycee.formsemestre_etuds_lycees,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/scodoc_table_etuds_lycees",
|
|
|
|
sco_lycee.scodoc_table_etuds_lycees,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
sco_publish(
|
2023-02-12 13:36:47 +01:00
|
|
|
"/formsemestre_graph_cursus",
|
|
|
|
sco_report.formsemestre_graph_cursus,
|
2021-05-31 00:14:15 +02:00
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2022-09-26 22:54:49 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_but_indicateurs",
|
|
|
|
sco_report_but.formsemestre_but_indicateurs,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_poursuite_report",
|
|
|
|
sco_poursuite_dut.formsemestre_poursuite_report,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
2021-08-29 23:04:38 +02:00
|
|
|
sco_publish(
|
|
|
|
"/pe_view_sem_recap",
|
|
|
|
pe_view.pe_view_sem_recap,
|
|
|
|
Permission.ScoView,
|
|
|
|
methods=["GET", "POST"],
|
|
|
|
)
|
2021-05-31 00:14:15 +02:00
|
|
|
sco_publish(
|
|
|
|
"/report_debouche_date", sco_debouche.report_debouche_date, Permission.ScoView
|
|
|
|
)
|
|
|
|
sco_publish(
|
|
|
|
"/formsemestre_estim_cost",
|
|
|
|
sco_cost_formation.formsemestre_estim_cost,
|
|
|
|
Permission.ScoView,
|
|
|
|
)
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/check_sem_integrity")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2023-09-29 21:17:31 +02:00
|
|
|
@permission_required(Permission.EditFormSemestre)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def check_sem_integrity(formsemestre_id, fix=False):
|
2021-05-31 00:14:15 +02:00
|
|
|
"""Debug.
|
|
|
|
Check that ue and module formations are consistents
|
|
|
|
"""
|
2021-08-19 10:28:35 +02:00
|
|
|
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
|
2021-10-15 14:00:51 +02:00
|
|
|
modimpls = sco_moduleimpl.moduleimpl_list(formsemestre_id=formsemestre_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
bad_ue = []
|
|
|
|
bad_sem = []
|
2021-07-07 10:01:36 +02:00
|
|
|
formations_set = set() # les formations mentionnées dans les UE et modules
|
2021-05-31 00:14:15 +02:00
|
|
|
for modimpl in modimpls:
|
2021-10-16 19:20:36 +02:00
|
|
|
mod = sco_edit_module.module_list({"module_id": modimpl["module_id"]})[0]
|
2021-07-07 10:01:36 +02:00
|
|
|
formations_set.add(mod["formation_id"])
|
2021-10-17 23:19:26 +02:00
|
|
|
ue = sco_edit_ue.ue_list({"ue_id": mod["ue_id"]})[0]
|
2021-07-07 10:01:36 +02:00
|
|
|
formations_set.add(ue["formation_id"])
|
2021-05-31 00:14:15 +02:00
|
|
|
if ue["formation_id"] != mod["formation_id"]:
|
|
|
|
modimpl["mod"] = mod
|
|
|
|
modimpl["ue"] = ue
|
|
|
|
bad_ue.append(modimpl)
|
|
|
|
if sem["formation_id"] != mod["formation_id"]:
|
|
|
|
bad_sem.append(modimpl)
|
|
|
|
modimpl["mod"] = mod
|
|
|
|
|
2021-07-07 10:01:36 +02:00
|
|
|
H = [
|
2021-07-29 16:58:18 +02:00
|
|
|
html_sco_header.sco_header(),
|
2021-07-07 10:01:36 +02:00
|
|
|
"<p>formation_id=%s" % sem["formation_id"],
|
|
|
|
]
|
|
|
|
if bad_ue:
|
|
|
|
H += [
|
|
|
|
"<h2>Modules d'une autre formation que leur UE:</h2>",
|
2022-10-02 23:43:29 +02:00
|
|
|
"<br>".join([str(x) for x in bad_ue]),
|
2021-07-07 10:01:36 +02:00
|
|
|
]
|
|
|
|
if bad_sem:
|
|
|
|
H += [
|
|
|
|
"<h2>Module du semestre dans une autre formation:</h2>",
|
2022-10-02 23:43:29 +02:00
|
|
|
"<br>".join([str(x) for x in bad_sem]),
|
2021-07-07 10:01:36 +02:00
|
|
|
]
|
|
|
|
if not bad_ue and not bad_sem:
|
|
|
|
H.append("<p>Aucun problème à signaler !</p>")
|
|
|
|
else:
|
|
|
|
log("check_sem_integrity: problem detected: formations_set=%s" % formations_set)
|
|
|
|
if sem["formation_id"] in formations_set:
|
|
|
|
formations_set.remove(sem["formation_id"])
|
|
|
|
if len(formations_set) == 1:
|
|
|
|
if fix:
|
|
|
|
log("check_sem_integrity: trying to fix %s" % formsemestre_id)
|
|
|
|
formation_id = formations_set.pop()
|
|
|
|
if sem["formation_id"] != formation_id:
|
|
|
|
sem["formation_id"] = formation_id
|
2021-08-19 10:28:35 +02:00
|
|
|
sco_formsemestre.do_formsemestre_edit(sem)
|
2021-07-07 10:01:36 +02:00
|
|
|
H.append("""<p class="alert">Problème réparé: vérifiez</p>""")
|
|
|
|
else:
|
|
|
|
H.append(
|
|
|
|
"""
|
2022-12-24 22:06:22 +01:00
|
|
|
<p class="alert">Problème détecté réparable:
|
2021-07-07 10:01:36 +02:00
|
|
|
<a href="check_sem_integrity?formsemestre_id=%s&fix=1">réparer maintenant</a></p>
|
|
|
|
"""
|
|
|
|
% (formsemestre_id,)
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
H.append("""<p class="alert">Problème détecté !</p>""")
|
|
|
|
|
2021-07-29 10:19:00 +02:00
|
|
|
return "\n".join(H) + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/check_form_integrity")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def check_form_integrity(formation_id, fix=False):
|
2021-05-31 00:14:15 +02:00
|
|
|
"debug"
|
|
|
|
log("check_form_integrity: formation_id=%s fix=%s" % (formation_id, fix))
|
2021-10-17 23:19:26 +02:00
|
|
|
ues = sco_edit_ue.ue_list(args={"formation_id": formation_id})
|
2021-05-31 00:14:15 +02:00
|
|
|
bad = []
|
|
|
|
for ue in ues:
|
2021-10-17 23:19:26 +02:00
|
|
|
mats = sco_edit_matiere.matiere_list(args={"ue_id": ue["ue_id"]})
|
2021-05-31 00:14:15 +02:00
|
|
|
for mat in mats:
|
2021-10-16 19:20:36 +02:00
|
|
|
mods = sco_edit_module.module_list({"matiere_id": mat["matiere_id"]})
|
2021-05-31 00:14:15 +02:00
|
|
|
for mod in mods:
|
|
|
|
if mod["ue_id"] != ue["ue_id"]:
|
|
|
|
if fix:
|
|
|
|
# fix mod.ue_id
|
|
|
|
log(
|
|
|
|
"fix: mod.ue_id = %s (was %s)" % (ue["ue_id"], mod["ue_id"])
|
|
|
|
)
|
|
|
|
mod["ue_id"] = ue["ue_id"]
|
2021-08-20 01:09:55 +02:00
|
|
|
sco_edit_module.do_module_edit(mod)
|
2021-05-31 00:14:15 +02:00
|
|
|
bad.append(mod)
|
|
|
|
if mod["formation_id"] != formation_id:
|
|
|
|
bad.append(mod)
|
|
|
|
if bad:
|
2022-10-02 23:43:29 +02:00
|
|
|
txth = "<br>".join([str(x) for x in bad])
|
2021-05-31 00:14:15 +02:00
|
|
|
txt = "\n".join([str(x) for x in bad])
|
|
|
|
log("check_form_integrity: formation_id=%s\ninconsistencies:" % formation_id)
|
|
|
|
log(txt)
|
|
|
|
# Notify by e-mail
|
2021-09-18 13:42:19 +02:00
|
|
|
send_scodoc_alarm("Notes: formation incoherente !", txt)
|
2021-05-31 00:14:15 +02:00
|
|
|
else:
|
|
|
|
txth = "OK"
|
|
|
|
log("ok")
|
2021-07-29 16:58:18 +02:00
|
|
|
return html_sco_header.sco_header() + txth + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/check_formsemestre_integrity")
|
2021-08-13 00:34:58 +02:00
|
|
|
@scodoc
|
2021-05-31 00:14:15 +02:00
|
|
|
@permission_required(Permission.ScoView)
|
2021-08-21 00:24:51 +02:00
|
|
|
@scodoc7func
|
2021-09-27 10:20:10 +02:00
|
|
|
def check_formsemestre_integrity(formsemestre_id):
|
2021-05-31 00:14:15 +02:00
|
|
|
"debug"
|
|
|
|
log("check_formsemestre_integrity: formsemestre_id=%s" % (formsemestre_id))
|
|
|
|
# verifie que tous les moduleimpl d'un formsemestre
|
|
|
|
# se réfèrent à un module dont l'UE appartient a la même formation
|
|
|
|
# Ancien bug: les ue_id étaient mal copiés lors des création de versions
|
|
|
|
# de formations
|
|
|
|
diag = []
|
|
|
|
|
2021-10-15 14:00:51 +02:00
|
|
|
Mlist = sco_moduleimpl.moduleimpl_withmodule_list(formsemestre_id=formsemestre_id)
|
2021-05-31 00:14:15 +02:00
|
|
|
for mod in Mlist:
|
|
|
|
if mod["module"]["ue_id"] != mod["matiere"]["ue_id"]:
|
|
|
|
diag.append(
|
|
|
|
"moduleimpl %s: module.ue_id=%s != matiere.ue_id=%s"
|
|
|
|
% (
|
|
|
|
mod["moduleimpl_id"],
|
|
|
|
mod["module"]["ue_id"],
|
|
|
|
mod["matiere"]["ue_id"],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if mod["ue"]["formation_id"] != mod["module"]["formation_id"]:
|
|
|
|
diag.append(
|
|
|
|
"moduleimpl %s: ue.formation_id=%s != mod.formation_id=%s"
|
|
|
|
% (
|
|
|
|
mod["moduleimpl_id"],
|
|
|
|
mod["ue"]["formation_id"],
|
|
|
|
mod["module"]["formation_id"],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if diag:
|
2021-08-29 19:57:32 +02:00
|
|
|
send_scodoc_alarm(
|
2021-05-31 00:14:15 +02:00
|
|
|
"Notes: formation incoherente dans semestre %s !" % formsemestre_id,
|
|
|
|
"\n".join(diag),
|
|
|
|
)
|
|
|
|
log("check_formsemestre_integrity: formsemestre_id=%s" % formsemestre_id)
|
|
|
|
log("inconsistencies:\n" + "\n".join(diag))
|
|
|
|
else:
|
|
|
|
diag = ["OK"]
|
|
|
|
log("ok")
|
|
|
|
return (
|
2022-10-02 23:43:29 +02:00
|
|
|
html_sco_header.sco_header() + "<br>".join(diag) + html_sco_header.sco_footer()
|
2021-05-31 00:14:15 +02:00
|
|
|
)
|