From a1f534093538fb2405aa53624583b17723d13c6f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 24 Mar 2024 11:23:40 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9bouch=C3=A9s:=20tags.=20Implements=20#39?= =?UTF-8?q?6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_debouche.py | 89 ++++++++++++++++----------- app/scodoc/sco_formsemestre_status.py | 9 ++- 2 files changed, 61 insertions(+), 37 deletions(-) diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py index f027b553c..85a0f8cef 100644 --- a/app/scodoc/sco_debouche.py +++ b/app/scodoc/sco_debouche.py @@ -71,12 +71,10 @@ def report_debouche_date(start_year=None, fmt="html"): etudids = get_etudids_with_debouche(start_year) tab = table_debouche_etudids(etudids, keep_numeric=keep_numeric) - tab.filename = scu.make_filename("debouche_scodoc_%s" % start_year) - tab.origin = ( - "Généré par %s le " % sco_version.SCONAME + scu.timedate_human_repr() + "" - ) - tab.caption = "Récapitulatif débouchés à partir du 1/1/%s." % start_year - tab.base_url = "%s?start_year=%s" % (request.base_url, start_year) + tab.filename = scu.make_filename(f"debouche_scodoc_{start_year}") + tab.origin = f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}" + tab.caption = f"Récapitulatif débouchés à partir du 1/1/{start_year}." + tab.base_url = f"{request.base_url}?start_year={start_year}" return tab.make_page( title="""

Débouchés étudiants

""", init_qtip=True, @@ -118,7 +116,16 @@ def get_etudids_with_debouche(start_year): def table_debouche_etudids(etudids, keep_numeric=True): """Rapport pour ces étudiants""" - L = [] + rows = [] + # Recherche les débouchés: + itemsuivi_etuds = {etudid: itemsuivi_list_etud(etudid) for etudid in etudids} + all_tags = set() + for debouche in itemsuivi_etuds.values(): + if debouche: + for it in debouche: + all_tags.update(tag.strip() for tag in it["tags"].split(",")) + all_tags = tuple(sorted(all_tags)) + for etudid in etudids: etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0] # retrouve le "dernier" semestre (au sens de la date de fin) @@ -152,25 +159,33 @@ def table_debouche_etudids(etudids, keep_numeric=True): "sem_ident": "%s %s" % (last_sem["date_debut_iso"], last_sem["titre"]), # utile pour tris } - # recherche des débouchés - debouche = itemsuivi_list_etud(etudid) # liste de plusieurs items + debouche = itemsuivi_etuds[etudid] # liste de plusieurs items if debouche: - row["debouche"] = "
".join( - [ - str(it["item_date"]) - + " : " - + it["situation"] - + " " - + it["tags"] - + "" - for it in debouche - ] - ) # + if keep_numeric: # pour excel: + row["debouche"] = "\n".join( + f"""{it["item_date"]}: {it["situation"]}""" for it in debouche + ) + else: + row["debouche"] = "
".join( + [ + str(it["item_date"]) + + " : " + + it["situation"] + + " " + + it["tags"] + + "" + for it in debouche + ] + ) + for it in debouche: + for tag in it["tags"].split(","): + tag = tag.strip() + row[f"tag_{tag}"] = tag else: row["debouche"] = "non renseigné" - L.append(row) - L.sort(key=lambda x: x["sem_ident"]) + rows.append(row) + rows.sort(key=lambda x: x["sem_ident"]) titles = { "civilite": "", @@ -184,21 +199,25 @@ def table_debouche_etudids(etudids, keep_numeric=True): "effectif": "Eff.", "debouche": "Débouché", } + columns_ids = [ + "semestre", + "semestre_id", + "periode", + "civilite", + "nom", + "prenom", + "moy", + "rang", + "effectif", + "debouche", + ] + for tag in all_tags: + titles[f"tag_{tag}"] = tag + columns_ids.append(f"tag_{tag}") tab = GenTable( - columns_ids=( - "semestre", - "semestre_id", - "periode", - "civilite", - "nom", - "prenom", - "moy", - "rang", - "effectif", - "debouche", - ), + columns_ids=columns_ids, titles=titles, - rows=L, + rows=rows, # html_col_width='4em', html_sortable=True, html_class="table_leftalign table_listegroupe", diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 9f1581dc3..2563e5a72 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -1495,7 +1495,12 @@ def formsemestre_note_etuds_sans_notes( {message} -
+ + @@ -1506,7 +1511,7 @@ def formsemestre_note_etuds_sans_notes( - +
{html_sco_header.sco_footer()} """