From bd9bf8711230e79f47b811e0e8b0e468f3e3d1ec Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 5 Apr 2024 00:23:29 +0200 Subject: [PATCH] =?UTF-8?q?Enrichissement=20du=20tableau=20des=20formation?= =?UTF-8?q?s=20(coche=20'd=C3=A9tails')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_dept.py | 2 +- app/scodoc/sco_formations.py | 32 ++++++++++++++++++++++++++------ app/static/css/scodoc.css | 10 +++++----- app/views/notes.py | 12 ++++++++++-- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/app/scodoc/sco_dept.py b/app/scodoc/sco_dept.py index a3815bbb..9717a5b5 100644 --- a/app/scodoc/sco_dept.py +++ b/app/scodoc/sco_dept.py @@ -148,7 +148,7 @@ def _convert_formsemestres_to_dicts( ), "formsemestre_id": formsemestre.id, "groupicon": groupicon if nb_inscrits > 0 else emptygroupicon, - "lockimg": lockicon, + "lockimg": "" if formsemestre.etat else lockicon, "modalite": formsemestre.modalite, "mois_debut": formsemestre.mois_debut(), "mois_fin": formsemestre.mois_fin(), diff --git a/app/scodoc/sco_formations.py b/app/scodoc/sco_formations.py index 6e9177f1..b129aaa8 100644 --- a/app/scodoc/sco_formations.py +++ b/app/scodoc/sco_formations.py @@ -489,9 +489,10 @@ def formation_import_xml(doc: str, import_tags=True, use_local_refcomp=False): return formation.id, modules_old2new, ues_old2new -def formation_list_table() -> GenTable: +def formation_list_table(detail: bool) -> GenTable: """List formation, grouped by titre and sorted by versions - and listing associated semestres + and listing associated semestres. + If detail, add column with more details. returns a table """ formations: list[Formation] = Formation.query.filter_by(dept_id=g.scodoc_dept_id) @@ -534,6 +535,15 @@ def formation_list_table() -> GenTable: if formation.referentiel_competence else "" ), + "_referentiel_target": ( + url_for( + "notes.refcomp_show", + scodoc_dept=g.scodoc_dept, + refcomp_id=formation.referentiel_competence.id, + ) + if formation.referentiel_competence + else "" + ), } # Ajoute les semestres associés à chaque formation: row["formsemestres"] = formation.formsemestres.order_by( @@ -561,10 +571,15 @@ def formation_list_table() -> GenTable: else [] ) ) + # Répartition des UEs dans les semestres + # utilise pour voir si la formation couvre tous les semestres + row["semestres_ues"] = ", ".join( + "S" + str(x if (x is not None and x > 0) else "-") + for x in sorted({ue.semestre_idx for ue in formation.ues}) + ) + # Date surtout utilisées pour le tri: if row["formsemestres"]: - row["date_fin_dernier_sem"] = ( - row["formsemestres"][-1].date_fin.isoformat(), - ) + row["date_fin_dernier_sem"] = row["formsemestres"][-1].date_fin.isoformat() row["annee_dernier_sem"] = row["formsemestres"][-1].date_fin.year else: row["date_fin_dernier_sem"] = "" @@ -617,6 +632,8 @@ def formation_list_table() -> GenTable: "commentaire", "sems_list_txt", ) + if detail: + columns_ids += ("annee_dernier_sem", "semestres_ues") titles = { "buttons": "", "commentaire": "Commentaire", @@ -627,6 +644,9 @@ def formation_list_table() -> GenTable: "formation_code": "Code", "sems_list_txt": "Semestres", "referentiel": "Réf.", + "date_fin_dernier_sem": "Fin dernier sem.", + "annee_dernier_sem": "Année dernier sem.", + "semestres_ues": "Semestres avec UEs", } return GenTable( columns_ids=columns_ids, @@ -639,7 +659,7 @@ def formation_list_table() -> GenTable: html_class="formation_list_table table_leftalign", html_with_td_classes=True, html_sortable=True, - base_url=f"{request.base_url}", + base_url=f"{request.base_url}" + ("?detail=on" if detail else ""), page_title=title, pdf_title=title, preferences=sco_preferences.SemPreferences(), diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 105b2e36..fa08e535 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -2411,10 +2411,10 @@ li.notes_formation_list { padding-top: 10px; } -table.formation_list_table { - width: 100%; +table.dataTable.formation_list_table.gt_table { border-collapse: collapse; - background-color: rgb(0%, 90%, 90%); + margin-right: 12px; + margin-left: 12px; } table#formation_list_table tr.gt_hl { @@ -2455,8 +2455,8 @@ table.formation_list_table td.buttons span.but_placeholder { text-align: center; } -.formation_list_table td.titre { - width: 45%; +.formation_list_table td.sems_list_txt { + width: 15%; } .formation_list_table td.commentaire { diff --git a/app/views/notes.py b/app/views/notes.py index 242f9d8f..2e032363 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -691,15 +691,23 @@ def module_clone(): def index_html(): "Page accueil formations" fmt = request.args.get("fmt", "html") + detail = scu.to_bool(request.args.get("detail", False)) + editable = current_user.has_permission(Permission.EditFormation) - table = sco_formations.formation_list_table() + table = sco_formations.formation_list_table(detail=detail) if fmt != "html": return table.make_page(fmt=fmt, filename=f"Formations-{g.scodoc_dept}") H = [ html_sco_header.sco_header(page_title="Formations (programmes)"), - """

Formations (programmes pédagogiques)

+ f"""

Formations (programmes pédagogiques)

+
+ + +
""", table.html(), ]