2020-09-26 16:19:37 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# Gestion scolarite IUT
|
|
|
|
#
|
2023-12-31 23:04:06 +01:00
|
|
|
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Module "Avis de poursuite d'étude"
|
|
|
|
# conçu et développé par Cléo Baras (IUT de Grenoble)
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
|
|
|
|
"""ScoDoc : interface des fonctions de gestion des avis de poursuites d'étude
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2024-01-27 13:13:44 +01:00
|
|
|
from flask import flash, g, redirect, render_template, request, send_file, url_for
|
2024-01-16 09:21:02 +01:00
|
|
|
|
2024-01-27 13:37:01 +01:00
|
|
|
from app.decorators import permission_required, scodoc
|
2024-01-16 09:21:02 +01:00
|
|
|
from app.models import FormSemestre
|
2024-01-25 19:42:22 +01:00
|
|
|
from app.pe import pe_comp
|
|
|
|
from app.pe import pe_jury
|
2024-01-27 13:13:44 +01:00
|
|
|
from app.views import ScoData
|
|
|
|
from app.scodoc.sco_exceptions import ScoValueError
|
2024-01-27 13:37:01 +01:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
2024-01-27 13:13:44 +01:00
|
|
|
import app.scodoc.sco_utils as scu
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-01-27 13:37:01 +01:00
|
|
|
from app.views import notes_bp as bp
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-01-27 13:37:01 +01:00
|
|
|
|
|
|
|
@bp.route("/pe_view_sem_recap/<int:formsemestre_id>", methods=("GET", "POST"))
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
2024-01-27 13:13:44 +01:00
|
|
|
def pe_view_sem_recap(formsemestre_id: int):
|
2021-08-31 20:18:50 +02:00
|
|
|
"""Génération des avis de poursuite d'étude"""
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-01-27 13:13:44 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
|
|
|
if not formsemestre.formation.is_apc():
|
2024-01-16 15:51:22 +01:00
|
|
|
raise ScoValueError(
|
2024-01-27 13:13:44 +01:00
|
|
|
"""Le module de Poursuites d'Etudes
|
|
|
|
n'est disponible que pour des formations BUT"""
|
2024-01-16 15:51:22 +01:00
|
|
|
)
|
2024-01-16 09:21:02 +01:00
|
|
|
|
2024-01-27 13:13:44 +01:00
|
|
|
if formsemestre.formation.get_cursus().NB_SEM < 6:
|
2024-01-20 09:31:02 +01:00
|
|
|
raise ScoValueError(
|
2024-01-27 13:13:44 +01:00
|
|
|
"""Le module de Poursuites d'Etudes n'est pas prévu
|
|
|
|
pour une formation de moins de 6 semestres"""
|
2024-01-20 09:31:02 +01:00
|
|
|
)
|
|
|
|
# L'année du diplome
|
2024-01-27 13:13:44 +01:00
|
|
|
annee_diplome = pe_comp.get_annee_diplome_semestre(formsemestre)
|
|
|
|
|
2024-02-06 17:53:38 +01:00
|
|
|
# Cosemestres diplomants
|
|
|
|
cosemestres = pe_comp.get_cosemestres_diplomants(annee_diplome)
|
|
|
|
|
2024-01-27 13:13:44 +01:00
|
|
|
if request.method == "GET":
|
|
|
|
return render_template(
|
|
|
|
"pe/pe_view_sem_recap.j2",
|
|
|
|
annee_diplome=annee_diplome,
|
|
|
|
formsemestre=formsemestre,
|
|
|
|
sco=ScoData(formsemestre=formsemestre),
|
2024-02-06 17:53:38 +01:00
|
|
|
cosemestres=cosemestres,
|
2024-01-27 13:13:44 +01:00
|
|
|
)
|
2024-01-20 09:31:02 +01:00
|
|
|
|
2024-02-06 17:53:38 +01:00
|
|
|
# request.method == "POST"
|
2024-02-02 17:16:07 +01:00
|
|
|
jury = pe_jury.JuryPE(annee_diplome)
|
2024-01-27 12:21:21 +01:00
|
|
|
if not jury.diplomes_ids:
|
|
|
|
flash("aucun étudiant à considérer !")
|
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.pe_view_sem_recap",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
data = jury.get_zipped_data()
|
|
|
|
|
2021-08-31 20:18:50 +02:00
|
|
|
return send_file(
|
|
|
|
data,
|
|
|
|
mimetype="application/zip",
|
2024-01-20 09:31:02 +01:00
|
|
|
download_name=scu.sanitize_filename(jury.nom_export_zip + ".zip"),
|
2021-08-31 20:18:50 +02:00
|
|
|
as_attachment=True,
|
|
|
|
)
|