Liste groupe: affichage optionnel de la date d'inscription

This commit is contained in:
ilona 2024-08-23 16:33:35 +02:00
parent 430b378723
commit d8f6fe35e9
4 changed files with 69 additions and 24 deletions

View File

@ -45,6 +45,7 @@ from openpyxl.worksheet.worksheet import Worksheet
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app import log from app import log
from app.models.scolar_event import ScolarEvent
from app.scodoc.sco_exceptions import ScoValueError from app.scodoc.sco_exceptions import ScoValueError
from app.scodoc import notesdb, sco_preferences from app.scodoc import notesdb, sco_preferences
@ -638,11 +639,12 @@ def excel_feuille_listeappel(
lines, lines,
partitions=None, partitions=None,
with_codes=False, with_codes=False,
with_date_inscription=False,
with_paiement=False, with_paiement=False,
server_name=None, server_name=None,
edt_params: dict = None, edt_params: dict = None,
): ):
"""generation feuille appel """Génération feuille appel.
edt_params : edt_params :
- "discipline" : Discipline - "discipline" : Discipline
@ -763,7 +765,8 @@ def excel_feuille_listeappel(
cells.append(ws.make_cell("etudid", style3)) cells.append(ws.make_cell("etudid", style3))
cells.append(ws.make_cell("code_nip", style3)) cells.append(ws.make_cell("code_nip", style3))
cells.append(ws.make_cell("code_ine", style3)) cells.append(ws.make_cell("code_ine", style3))
if with_date_inscription:
cells.append(ws.make_cell("Date inscr.", style3))
# case Groupes # case Groupes
cells.append(ws.make_cell("Groupes", style3)) cells.append(ws.make_cell("Groupes", style3))
letter_int += 1 letter_int += 1
@ -805,7 +808,15 @@ def excel_feuille_listeappel(
cells.append(ws.make_cell(code_nip, style2t3)) cells.append(ws.make_cell(code_nip, style2t3))
code_ine = t.get("code_ine", "") code_ine = t.get("code_ine", "")
cells.append(ws.make_cell(code_ine, style2t3)) cells.append(ws.make_cell(code_ine, style2t3))
if with_date_inscription:
event = ScolarEvent.query.filter_by(
etudid=t["etudid"],
event_type="INSCRIPTION",
formsemestre_id=formsemestre_id,
).first()
if event:
date_inscription = event.event_date
cells.append(ws.make_cell(date_inscription, style2t3))
cells.append(ws.make_cell(style=style2t3)) cells.append(ws.make_cell(style=style2t3))
ws.append_row(cells) ws.append_row(cells)
ws.set_row_dimension_height(row_id, 30) ws.set_row_dimension_height(row_id, 30)

View File

@ -40,7 +40,7 @@ from flask import url_for, g, render_template, request
from flask_login import current_user from flask_login import current_user
from app import db from app import db
from app.models import FormSemestre, Identite from app.models import FormSemestre, Identite, ScolarEvent
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
from app.scodoc import sco_assiduites as scass from app.scodoc import sco_assiduites as scass
@ -70,6 +70,7 @@ def groups_lists(
group_ids=(), group_ids=(),
fmt="html", fmt="html",
with_codes=0, with_codes=0,
with_date_inscription=0,
etat=None, etat=None,
with_paiement=0, with_paiement=0,
with_archives=0, with_archives=0,
@ -102,6 +103,7 @@ def groups_lists(
groups_infos=groups_infos, groups_infos=groups_infos,
fmt=fmt, fmt=fmt,
with_codes=with_codes, with_codes=with_codes,
with_date_inscription=with_date_inscription,
etat=etat, etat=etat,
with_paiement=with_paiement, with_paiement=with_paiement,
with_archives=with_archives, with_archives=with_archives,
@ -121,6 +123,7 @@ def groups_lists(
groups_infos=groups_infos, groups_infos=groups_infos,
fmt=fmt, fmt=fmt,
with_codes=with_codes, with_codes=with_codes,
with_date_inscription=with_date_inscription,
etat=etat, etat=etat,
with_paiement=with_paiement, with_paiement=with_paiement,
with_archives=with_archives, with_archives=with_archives,
@ -507,6 +510,7 @@ class DisplayedGroupsInfos:
def groups_table( def groups_table(
groups_infos: DisplayedGroupsInfos = None, groups_infos: DisplayedGroupsInfos = None,
with_codes=0, with_codes=0,
with_date_inscription=0,
etat=None, etat=None,
fmt="html", fmt="html",
with_paiement=0, # si vrai, ajoute colonnes infos paiement droits et finalisation inscription (lent car interrogation portail) with_paiement=0, # si vrai, ajoute colonnes infos paiement droits et finalisation inscription (lent car interrogation portail)
@ -522,15 +526,16 @@ def groups_table(
can_view_etud_data = int(current_user.has_permission(Permission.ViewEtudData)) can_view_etud_data = int(current_user.has_permission(Permission.ViewEtudData))
with_codes = int(with_codes) with_codes = int(with_codes)
with_date_inscription = int(with_date_inscription)
with_paiement = int(with_paiement) and can_view_etud_data with_paiement = int(with_paiement) and can_view_etud_data
with_archives = int(with_archives) and can_view_etud_data with_archives = int(with_archives) and can_view_etud_data
with_annotations = int(with_annotations) and can_view_etud_data with_annotations = int(with_annotations) and can_view_etud_data
with_bourse = int(with_bourse) and can_view_etud_data with_bourse = int(with_bourse) and can_view_etud_data
base_url_np = groups_infos.base_url + f"&with_codes={with_codes}"
base_url = ( base_url = (
base_url_np groups_infos.base_url
+ f"""&with_paiement={with_paiement}&with_archives={ + f"""&with_codes={with_codes}&with_date_inscription={
with_date_inscription}&with_paiement={with_paiement}&with_archives={
with_archives}&with_annotations={with_annotations with_archives}&with_annotations={with_annotations
}&with_bourse={with_bourse}""" }&with_bourse={with_bourse}"""
) )
@ -546,6 +551,7 @@ def groups_table(
"etudid": "etudid", "etudid": "etudid",
"code_nip": "code_nip", "code_nip": "code_nip",
"code_ine": "code_ine", "code_ine": "code_ine",
"date_inscription": "Date inscription",
"datefinalisationinscription_str": "Finalisation inscr.", "datefinalisationinscription_str": "Finalisation inscr.",
"paiementinscription_str": "Paiement", "paiementinscription_str": "Paiement",
"etudarchive": "Fichiers", "etudarchive": "Fichiers",
@ -579,9 +585,11 @@ def groups_table(
if with_codes: if with_codes:
columns_ids += ["etape", "etudid", "code_nip", "code_ine"] columns_ids += ["etape", "etudid", "code_nip", "code_ine"]
if with_date_inscription:
columns_ids += ["date_inscription"]
if with_paiement: if with_paiement:
columns_ids += ["datefinalisationinscription_str", "paiementinscription_str"] columns_ids += ["datefinalisationinscription_str", "paiementinscription_str"]
if with_paiement: # or with_codes: if with_paiement:
sco_portal_apogee.check_paiement_etuds(groups_infos.members) sco_portal_apogee.check_paiement_etuds(groups_infos.members)
if with_archives: if with_archives:
from app.scodoc import sco_archives_etud from app.scodoc import sco_archives_etud
@ -597,6 +605,16 @@ def groups_table(
moodle_groupenames = set() moodle_groupenames = set()
# ajoute liens # ajoute liens
for etud_info in groups_infos.members: for etud_info in groups_infos.members:
if with_date_inscription:
event = ScolarEvent.query.filter_by(
etudid=etud_info["etudid"],
event_type="INSCRIPTION",
formsemestre_id=groups_infos.formsemestre_id,
).first()
if event:
etud_info["date_inscription"] = event.event_date.strftime(scu.DATE_FMT)
etud_info["_date_inscription_xls"] = event.event_date
etud_info["_date_inscription_order"] = event.event_date.isoformat
if etud_info["email"]: if etud_info["email"]:
etud_info["_email_target"] = "mailto:" + etud_info["email"] etud_info["_email_target"] = "mailto:" + etud_info["email"]
else: else:
@ -612,8 +630,8 @@ def groups_table(
etud_info["_nom_disp_order"] = etud_sort_key(etud_info) etud_info["_nom_disp_order"] = etud_sort_key(etud_info)
etud_info["_prenom_target"] = fiche_url etud_info["_prenom_target"] = fiche_url
etud_info["_nom_disp_td_attrs"] = 'id="%s" class="etudinfo"' % ( etud_info["_nom_disp_td_attrs"] = (
etud_info["etudid"] f"""id="{etud_info['etudid']}" class="etudinfo" """
) )
etud_info["bourse_str"] = "oui" if etud_info["boursier"] else "non" etud_info["bourse_str"] = "oui" if etud_info["boursier"] else "non"
if etud_info["etat"] == "D": if etud_info["etat"] == "D":
@ -720,6 +738,7 @@ def groups_table(
if groups_infos.members: if groups_infos.members:
options = { options = {
"with_codes": "Affiche codes", "with_codes": "Affiche codes",
"with_date_inscription": "Date inscription",
} }
if can_view_etud_data: if can_view_etud_data:
options.update( options.update(
@ -824,6 +843,7 @@ def groups_table(
groups_infos.members, groups_infos.members,
partitions=groups_infos.partitions, partitions=groups_infos.partitions,
with_codes=with_codes, with_codes=with_codes,
with_date_inscription=with_date_inscription,
with_paiement=with_paiement, with_paiement=with_paiement,
server_name=request.url_root, server_name=request.url_root,
) )

View File

@ -48,13 +48,12 @@ function change_list_options(selected_options) {
"with_archives", "with_archives",
"with_annotations", "with_annotations",
"with_codes", "with_codes",
"with_date_inscription",
"with_bourse", "with_bourse",
]; ];
for (var i = 0; i < options.length; i++) { for (var i = 0; i < options.length; i++) {
var option = options[i]; let option = options[i];
if ($.inArray(option, selected_options) >= 0) { urlParams.set(option, selected_options.indexOf(option) >= 0 ? "1" : "0");
urlParams.set(option, "1");
}
} }
window.location = url.href; window.location = url.href;
} }
@ -62,23 +61,32 @@ function change_list_options(selected_options) {
// Menu choix groupe: // Menu choix groupe:
function toggle_visible_etuds() { function toggle_visible_etuds() {
// //
$(".etud_elem").hide(); document.querySelectorAll('.etud_elem').forEach(element => {
element.style.display = 'none';
});
var qargs = ""; var qargs = "";
$("#group_ids_sel option:selected").each(function (index, opt) { var selectedOptions = document.querySelectorAll("#group_ids_sel option:checked");
var qargs = "";
selectedOptions.forEach(function (opt) {
var group_id = opt.value; var group_id = opt.value;
$(".group-" + group_id).show(); var groupElements = document.querySelectorAll(".group-" + group_id);
groupElements.forEach(function (elem) {
elem.style.display = "block";
});
qargs += "&group_ids=" + group_id; qargs += "&group_ids=" + group_id;
}); });
// Update url saisie tableur: // Update url saisie tableur:
var input_eval = $("#formnotes_evaluation_id"); let input_eval = document.querySelectorAll("#formnotes_evaluation_id");
if (input_eval.length > 0) { if (input_eval.length > 0) {
var evaluation_id = input_eval[0].value; let evaluation_id = input_eval[0].value;
$("#menu_saisie_tableur a").attr( let menu_saisie_tableur_a = document.querySelector("#menu_saisie_tableur a");
menu_saisie_tableur_a.setAttribute(
"href", "href",
"saisie_notes_tableur?evaluation_id=" + evaluation_id + qargs "saisie_notes_tableur?evaluation_id=" + evaluation_id + qargs
); );
// lien feuille excel: // lien feuille excel:
$("#lnk_feuille_saisie").attr( let lnk_feuille_saisie = document.querySelector("#lnk_feuille_saisie");
lnk_feuille_saisie.setAttribute(
"href", "href",
"feuille_saisie_notes?evaluation_id=" + evaluation_id + qargs "feuille_saisie_notes?evaluation_id=" + evaluation_id + qargs
); );

View File

@ -471,18 +471,24 @@ def groups_lists(
fmt="html", fmt="html",
# Options pour listes: # Options pour listes:
with_codes=0, with_codes=0,
with_date_inscription=0,
etat=None, etat=None,
with_paiement=0, # si vrai, ajoute colonnes infos paiement droits et finalisation inscription (lent car interrogation portail) with_paiement=0,
with_archives=0, # ajoute colonne avec noms fichiers archivés with_archives=0,
with_annotations=0, with_annotations=0,
with_bourse=0, with_bourse=0,
formsemestre_id=None, formsemestre_id=None,
): ):
"Listes des étudiants des groupes" """Listes des étudiants des groupes.
Si with_paiement, ajoute colonnes infos paiement droits et finalisation
inscription (lent car interrogation portail).
Si with_archives, ajoute colonne avec noms fichiers archivés.
"""
return sco_groups_view.groups_lists( return sco_groups_view.groups_lists(
group_ids=group_ids, group_ids=group_ids,
fmt=fmt, fmt=fmt,
with_codes=with_codes, with_codes=with_codes,
with_date_inscription=with_date_inscription,
etat=etat, etat=etat,
with_paiement=with_paiement, with_paiement=with_paiement,
with_archives=with_archives, with_archives=with_archives,