WIP: PE : form paramétrage pe_view_sem_recap

This commit is contained in:
Emmanuel Viennet 2024-02-09 21:52:33 +01:00
parent 6cbeeedb1c
commit bcb801662a
3 changed files with 81 additions and 42 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 flask import flash, g, redirect, render_template, request, send_file, url_for
from app.decorators import permission_required, scodoc from app.decorators import permission_required, scodoc
from app.forms.pe.pe_sem_recap import ParametrageClasseurPE
from app.models import FormSemestre from app.models import FormSemestre
from app.pe import pe_comp from app.pe import pe_comp
from app.pe import pe_jury from app.pe import pe_jury
@ -73,17 +74,21 @@ def pe_view_sem_recap(formsemestre_id: int):
# Cosemestres diplomants # Cosemestres diplomants
cosemestres = pe_comp.get_cosemestres_diplomants(annee_diplome) cosemestres = pe_comp.get_cosemestres_diplomants(annee_diplome)
form = ParametrageClasseurPE()
if request.method == "GET": if request.method == "GET":
return render_template( return render_template(
"pe/pe_view_sem_recap.j2", "pe/pe_view_sem_recap.j2",
annee_diplome=annee_diplome, annee_diplome=annee_diplome,
form=form,
formsemestre=formsemestre, formsemestre=formsemestre,
sco=ScoData(formsemestre=formsemestre), sco=ScoData(formsemestre=formsemestre),
cosemestres=cosemestres, cosemestres=cosemestres,
) )
# request.method == "POST" # 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: if not jury.diplomes_ids:
flash("aucun étudiant à considérer !") flash("aucun étudiant à considérer !")
return redirect( return redirect(
@ -103,10 +108,10 @@ def pe_view_sem_recap(formsemestre_id: int):
as_attachment=True, as_attachment=True,
) )
return render_template( return redirect(
"pe/pe_view_sem_recap.j2", url_for(
annee_diplome=annee_diplome, "notes.formsemestre_status",
formsemestre=formsemestre, scodoc_dept=g.scodoc_dept,
sco=ScoData(formsemestre=formsemestre), formsemestre_id=formsemestre_id,
cosemestres=cosemestres, )
) )

View File

@ -1,4 +1,5 @@
{% extends "sco_page.j2" %} {% extends "sco_page.j2" %}
{% import 'wtf.j2' as wtf %}
{% block styles %} {% block styles %}
{{super()}} {{super()}}
@ -42,7 +43,9 @@
<h3>Avis de poursuites d'études de la promo {{ annee_diplome }}</h3> <h3>Avis de poursuites d'études de la promo {{ annee_diplome }}</h3>
<div class="help"> {{ 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 : Seront (a minima) pris en compte les étudiants ayant été inscrits aux semestres suivants :
<ul> <ul>
@ -54,22 +57,4 @@
</ul> </ul>
</div> </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 %} {% endblock app_content %}