Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
3 changed files with 83 additions and 33 deletions
Showing only changes of commit cf7d7d2db8 - Show all commits

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
@ -72,12 +73,16 @@ 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()
cosemestres_tries = pe_comp.tri_semestres_par_rang(cosemestres) 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} affichage_cosemestres_tries = {rang: ", ".join([sem.titre_annee() for sem in cosemestres_tries[rang]]) for rang in cosemestres_tries}
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=affichage_cosemestres_tries, cosemestres=affichage_cosemestres_tries,
@ -85,22 +90,31 @@ def pe_view_sem_recap(formsemestre_id: int):
) )
# request.method == "POST" # request.method == "POST"
jury = pe_jury.JuryPE(annee_diplome) if form.validate_on_submit():
if not jury.diplomes_ids: jury = pe_jury.JuryPE(annee_diplome, options=form.data)
flash("aucun étudiant à considérer !") if not jury.diplomes_ids:
return redirect( flash("aucun étudiant à considérer !")
url_for( return redirect(
"notes.pe_view_sem_recap", url_for(
scodoc_dept=g.scodoc_dept, "notes.pe_view_sem_recap",
formsemestre_id=formsemestre_id, scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
)
) )
data = jury.get_zipped_data()
return send_file(
data,
mimetype="application/zip",
download_name=scu.sanitize_filename(jury.nom_export_zip + ".zip"),
as_attachment=True,
) )
data = jury.get_zipped_data() return redirect(
url_for(
return send_file( "notes.formsemestre_status",
data, scodoc_dept=g.scodoc_dept,
mimetype="application/zip", formsemestre_id=formsemestre_id,
download_name=scu.sanitize_filename(jury.nom_export_zip + ".zip"), )
as_attachment=True,
) )

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,6 +43,10 @@
<h3>Avis de poursuites d'études de la promo {{ annee_diplome }}</h3> <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"> <div class="help">
Seront pris en compte les étudiants ayant (au moins) été inscrits à l'un des semestres suivants : Seront pris en compte les étudiants ayant (au moins) été inscrits à l'un des semestres suivants :
@ -54,22 +59,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 %}