forked from ScoDoc/ScoDoc
Assiduites : WIP tableaux options
This commit is contained in:
parent
1e98dd125e
commit
c0253bd05d
@ -16,13 +16,14 @@ class ListeAssiJusti(tb.Table):
|
||||
L'affichage par défaut se fait par ordre de date de fin décroissante.
|
||||
"""
|
||||
|
||||
NB_PAR_PAGE: int = 50
|
||||
NB_PAR_PAGE: int = 2
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*etudiants: tuple[Identite],
|
||||
filtre: "Filtre" = None,
|
||||
page: int = 1,
|
||||
nb_par_page: int = None,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
"""
|
||||
@ -36,7 +37,12 @@ class ListeAssiJusti(tb.Table):
|
||||
# Gestion du filtre, par défaut un filtre vide
|
||||
self.filtre = filtre if filtre is not None else Filtre()
|
||||
# Gestion de la pagination (par défaut page 1)
|
||||
self.page = page
|
||||
self.page: int = page
|
||||
self.nb_par_page: int = (
|
||||
nb_par_page if nb_par_page is not None else ListeAssiJusti.NB_PAR_PAGE
|
||||
)
|
||||
|
||||
self.total_page: int = None
|
||||
|
||||
# les lignes du tableau
|
||||
self.rows: list["RowAssiJusti"] = []
|
||||
@ -80,7 +86,7 @@ class ListeAssiJusti(tb.Table):
|
||||
|
||||
# Paginer la requête pour ne pas envoyer trop d'informations au client
|
||||
pagination: Pagination = self.paginer(query_finale)
|
||||
|
||||
self.total_pages: int = pagination.pages
|
||||
# Générer les lignes de la page
|
||||
for ligne in pagination.items:
|
||||
row: RowAssiJusti = self.row_class(self, ligne._asdict())
|
||||
@ -106,7 +112,7 @@ class ListeAssiJusti(tb.Table):
|
||||
résultats paginés.
|
||||
"""
|
||||
return query.paginate(
|
||||
page=self.page, per_page=ListeAssiJusti.NB_PAR_PAGE, error_out=False
|
||||
page=self.page, per_page=self.nb_par_page, error_out=False
|
||||
)
|
||||
|
||||
def joindre(self, query_assiduite: Query = None, query_justificatif: Query = None):
|
||||
|
@ -7,6 +7,37 @@
|
||||
|
||||
{% block app_content %}
|
||||
|
||||
<legend>
|
||||
Options
|
||||
<form action="" method="get">
|
||||
<label for="show_pres">afficher les présences</label>
|
||||
{% if show_pres %}
|
||||
<input type="checkbox" id="show_pres" name="show_pres" checked>
|
||||
{% else %}
|
||||
<input type="checkbox" id="show_pres" name="show_pres">
|
||||
{% endif %}
|
||||
|
||||
<label for="show_reta">afficher les retards</label>
|
||||
{% if show_reta %}
|
||||
<input type="checkbox" id="show_reta" name="show_reta" checked>
|
||||
{% else %}
|
||||
<input type="checkbox" id="show_reta" name="show_reta">
|
||||
{% endif %}
|
||||
<br>
|
||||
|
||||
<label for="nb_ligne_page">Nombre de ligne par page : </label>
|
||||
<input type="number" name="nb_ligne_page" id="nb_ligne_page" value="{{nb_ligne_page}}">
|
||||
|
||||
<label for="n_page">Page n°</label>
|
||||
<select name="n_page" id="n_page">
|
||||
{% for n in range(1,total_pages+1) %}
|
||||
<option value="{{n}}">{{n}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<br>
|
||||
<input type="submit" value="valider">
|
||||
</form>
|
||||
</legend>
|
||||
|
||||
{{tableau | safe}}
|
||||
|
||||
|
@ -327,7 +327,6 @@ def signal_assiduites_etud():
|
||||
),
|
||||
assi_morning=ScoDocSiteConfig.get("assi_morning_time", "08:00"),
|
||||
assi_evening=ScoDocSiteConfig.get("assi_afternoon_time", "18:00"),
|
||||
|
||||
saisie_eval=saisie_eval,
|
||||
date_deb=date_deb,
|
||||
date_fin=date_fin,
|
||||
@ -1045,18 +1044,39 @@ def visu_assi_group():
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/Test")
|
||||
@bp.route("/testTableau")
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
def test():
|
||||
def testTableau():
|
||||
"""Visualisation de l'assiduité d'un groupe entre deux dates"""
|
||||
fmt = request.args.get("fmt", "html")
|
||||
|
||||
etudid = request.args.get("etudid", 18114)
|
||||
etudid = request.args.get(
|
||||
"etudid", 18114
|
||||
) # TODO retirer la valeur par défaut de test
|
||||
|
||||
fmt = request.args.get("fmt", "html")
|
||||
show_pres: bool | str = request.args.get("show_pres", False)
|
||||
show_reta: bool | str = request.args.get("show_reta", False)
|
||||
|
||||
nb_ligne_page: int = request.args.get("nb_ligne_page")
|
||||
# Vérification de nb_ligne_page
|
||||
try:
|
||||
nb_ligne_page: int = int(nb_ligne_page)
|
||||
except (ValueError, TypeError):
|
||||
nb_ligne_page = None
|
||||
|
||||
page_number: int = request.args.get("n_page", 1)
|
||||
# Vérification de page_number
|
||||
try:
|
||||
page_number: int = int(page_number)
|
||||
except (ValueError, TypeError):
|
||||
page_number = 1
|
||||
|
||||
from app.tables.liste_assiduites import ListeAssiJusti
|
||||
|
||||
table: ListeAssiJusti = ListeAssiJusti(Identite.get_etud(etudid))
|
||||
table: ListeAssiJusti = ListeAssiJusti(
|
||||
Identite.get_etud(etudid), page=page_number, nb_par_page=nb_ligne_page
|
||||
)
|
||||
|
||||
if fmt.startswith("xls"):
|
||||
return scu.send_file(
|
||||
@ -1071,6 +1091,11 @@ def test():
|
||||
sco=ScoData(),
|
||||
tableau=table.html(),
|
||||
title=f"Test tableau",
|
||||
total_pages=table.total_pages,
|
||||
page_number=page_number,
|
||||
show_pres=show_pres,
|
||||
show_reta=show_reta,
|
||||
nb_ligne_page=nb_ligne_page,
|
||||
)
|
||||
|
||||
|
||||
@ -1354,10 +1379,10 @@ def generate_bul_list(etud: Identite, semestre: FormSemestre) -> str:
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/test", methods=["GET", "POST"])
|
||||
@bp.route("/testDate", methods=["GET", "POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
def test():
|
||||
def testDateutils():
|
||||
"""XXX fonction de test a retirer"""
|
||||
if request.method == "POST":
|
||||
print("test date_utils : ", request.form)
|
||||
|
Loading…
Reference in New Issue
Block a user