Merge remote-tracking branch 'scodoc/cleo-pe-BUT-v2' into pe-but-options

# Conflicts:
#	app/pe/pe_view.py
#	app/templates/pe/pe_view_sem_recap.j2
This commit is contained in:
Cléo Baras 2024-02-27 16:45:15 +01:00
commit cf7d7d2db8
3 changed files with 83 additions and 33 deletions

View File

@ -0,0 +1,49 @@
##############################################################################
#
# ScoDoc
#
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
#
# 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
#
##############################################################################
"""
Formulaire options génération table poursuite études (PE)
"""
from flask_wtf import FlaskForm
from wtforms import BooleanField, HiddenField, SubmitField
class ParametrageClasseurPE(FlaskForm):
"Formulaire paramétrage génération classeur PE"
cohorte_restreinte = BooleanField(
"Restreindre aux étudiants inscrits dans le semestre"
)
moyennes_tags = BooleanField("Générer les moyennes sur les tags de modules")
moyennes_ue_res_sae = BooleanField(
"Générer les moyennes des ressources et des SAEs par UE"
)
moyennes_ues_rcues = BooleanField("Générer moyennes des UEs et RCUEs (compétences)")
min_max_moy = BooleanField("Colonnes min/max/moy")
synthese_individuelle_etud = BooleanField(
"Générer la feuille synthèse avec un onglet par étudiant"
)
submit = SubmitField("Générer les classeurs poursuites d'études")
cancel = SubmitField("Annuler", render_kw={"formnovalidate": True})

View File

@ -38,6 +38,7 @@
from flask import flash, g, redirect, render_template, request, send_file, url_for
from app.decorators import permission_required, scodoc
from app.forms.pe.pe_sem_recap import ParametrageClasseurPE
from app.models import FormSemestre
from app.pe import pe_comp
from app.pe import pe_jury
@ -72,12 +73,16 @@ def pe_view_sem_recap(formsemestre_id: int):
# Cosemestres diplomants
cosemestres = pe_comp.get_cosemestres_diplomants(annee_diplome)
form = ParametrageClasseurPE()
cosemestres_tries = pe_comp.tri_semestres_par_rang(cosemestres)
affichage_cosemestres_tries = {rang: ", ".join([sem.titre_annee() for sem in cosemestres_tries[rang]]) for rang in cosemestres_tries}
if request.method == "GET":
return render_template(
"pe/pe_view_sem_recap.j2",
annee_diplome=annee_diplome,
form=form,
formsemestre=formsemestre,
sco=ScoData(formsemestre=formsemestre),
cosemestres=affichage_cosemestres_tries,
@ -85,7 +90,8 @@ def pe_view_sem_recap(formsemestre_id: int):
)
# request.method == "POST"
jury = pe_jury.JuryPE(annee_diplome)
if form.validate_on_submit():
jury = pe_jury.JuryPE(annee_diplome, options=form.data)
if not jury.diplomes_ids:
flash("aucun étudiant à considérer !")
return redirect(
@ -104,3 +110,11 @@ def pe_view_sem_recap(formsemestre_id: int):
download_name=scu.sanitize_filename(jury.nom_export_zip + ".zip"),
as_attachment=True,
)
return redirect(
url_for(
"notes.formsemestre_status",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
)
)

View File

@ -1,4 +1,5 @@
{% extends "sco_page.j2" %}
{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
@ -42,6 +43,10 @@
<h3>Avis de poursuites d'études de la promo {{ annee_diplome }}</h3>
{{ wtf.quick_form(form) }}
<div class="help" style="margin-top: 16px;">
Seront (a minima) pris en compte les étudiants ayant été inscrits aux semestres suivants :
<div class="help">
Seront pris en compte les étudiants ayant (au moins) été inscrits à l'un des semestres suivants :
@ -54,22 +59,4 @@
</ul>
</div>
<div>
<progress id="pe_progress" style="visibility: hidden"></progress>
<br>
<button onclick="submitPEGeneration()">Générer les documents de la promo {{ annee_diplome }}</button>
</div>
<form method="post" id="pe_generation" style="visibility: hidden">
<input type="submit"
onclick="submitPEGeneration()" value=""/>
<input type="hidden" name="formsemestre_id" value="{{formsemestre.id}}">
</form>
<script>
function submitPEGeneration() {
// document.getElementById("pe_progress").style.visibility = 'visible';
document.getElementById("pe_generation").submit(); //attach an id to your form
}
</script>
{% endblock app_content %}