forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -148,7 +148,7 @@ def _convert_formsemestres_to_dicts(
|
|||||||
),
|
),
|
||||||
"formsemestre_id": formsemestre.id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"groupicon": groupicon if nb_inscrits > 0 else emptygroupicon,
|
"groupicon": groupicon if nb_inscrits > 0 else emptygroupicon,
|
||||||
"lockimg": lockicon,
|
"lockimg": "" if formsemestre.etat else lockicon,
|
||||||
"modalite": formsemestre.modalite,
|
"modalite": formsemestre.modalite,
|
||||||
"mois_debut": formsemestre.mois_debut(),
|
"mois_debut": formsemestre.mois_debut(),
|
||||||
"mois_fin": formsemestre.mois_fin(),
|
"mois_fin": formsemestre.mois_fin(),
|
||||||
|
@ -489,9 +489,10 @@ def formation_import_xml(doc: str, import_tags=True, use_local_refcomp=False):
|
|||||||
return formation.id, modules_old2new, ues_old2new
|
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
|
"""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
|
returns a table
|
||||||
"""
|
"""
|
||||||
formations: list[Formation] = Formation.query.filter_by(dept_id=g.scodoc_dept_id)
|
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
|
if formation.referentiel_competence
|
||||||
else ""
|
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:
|
# Ajoute les semestres associés à chaque formation:
|
||||||
row["formsemestres"] = formation.formsemestres.order_by(
|
row["formsemestres"] = formation.formsemestres.order_by(
|
||||||
@ -561,10 +571,15 @@ def formation_list_table() -> GenTable:
|
|||||||
else []
|
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"]:
|
if row["formsemestres"]:
|
||||||
row["date_fin_dernier_sem"] = (
|
row["date_fin_dernier_sem"] = row["formsemestres"][-1].date_fin.isoformat()
|
||||||
row["formsemestres"][-1].date_fin.isoformat(),
|
|
||||||
)
|
|
||||||
row["annee_dernier_sem"] = row["formsemestres"][-1].date_fin.year
|
row["annee_dernier_sem"] = row["formsemestres"][-1].date_fin.year
|
||||||
else:
|
else:
|
||||||
row["date_fin_dernier_sem"] = ""
|
row["date_fin_dernier_sem"] = ""
|
||||||
@ -617,6 +632,8 @@ def formation_list_table() -> GenTable:
|
|||||||
"commentaire",
|
"commentaire",
|
||||||
"sems_list_txt",
|
"sems_list_txt",
|
||||||
)
|
)
|
||||||
|
if detail:
|
||||||
|
columns_ids += ("annee_dernier_sem", "semestres_ues")
|
||||||
titles = {
|
titles = {
|
||||||
"buttons": "",
|
"buttons": "",
|
||||||
"commentaire": "Commentaire",
|
"commentaire": "Commentaire",
|
||||||
@ -627,6 +644,9 @@ def formation_list_table() -> GenTable:
|
|||||||
"formation_code": "Code",
|
"formation_code": "Code",
|
||||||
"sems_list_txt": "Semestres",
|
"sems_list_txt": "Semestres",
|
||||||
"referentiel": "Réf.",
|
"referentiel": "Réf.",
|
||||||
|
"date_fin_dernier_sem": "Fin dernier sem.",
|
||||||
|
"annee_dernier_sem": "Année dernier sem.",
|
||||||
|
"semestres_ues": "Semestres avec UEs",
|
||||||
}
|
}
|
||||||
return GenTable(
|
return GenTable(
|
||||||
columns_ids=columns_ids,
|
columns_ids=columns_ids,
|
||||||
@ -639,7 +659,7 @@ def formation_list_table() -> GenTable:
|
|||||||
html_class="formation_list_table table_leftalign",
|
html_class="formation_list_table table_leftalign",
|
||||||
html_with_td_classes=True,
|
html_with_td_classes=True,
|
||||||
html_sortable=True,
|
html_sortable=True,
|
||||||
base_url=f"{request.base_url}",
|
base_url=f"{request.base_url}" + ("?detail=on" if detail else ""),
|
||||||
page_title=title,
|
page_title=title,
|
||||||
pdf_title=title,
|
pdf_title=title,
|
||||||
preferences=sco_preferences.SemPreferences(),
|
preferences=sco_preferences.SemPreferences(),
|
||||||
|
@ -2411,10 +2411,10 @@ li.notes_formation_list {
|
|||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.formation_list_table {
|
table.dataTable.formation_list_table.gt_table {
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
background-color: rgb(0%, 90%, 90%);
|
margin-right: 12px;
|
||||||
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#formation_list_table tr.gt_hl {
|
table#formation_list_table tr.gt_hl {
|
||||||
@ -2455,8 +2455,8 @@ table.formation_list_table td.buttons span.but_placeholder {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formation_list_table td.titre {
|
.formation_list_table td.sems_list_txt {
|
||||||
width: 45%;
|
width: 15%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formation_list_table td.commentaire {
|
.formation_list_table td.commentaire {
|
||||||
|
@ -691,15 +691,23 @@ def module_clone():
|
|||||||
def index_html():
|
def index_html():
|
||||||
"Page accueil formations"
|
"Page accueil formations"
|
||||||
fmt = request.args.get("fmt", "html")
|
fmt = request.args.get("fmt", "html")
|
||||||
|
detail = scu.to_bool(request.args.get("detail", False))
|
||||||
|
|
||||||
editable = current_user.has_permission(Permission.EditFormation)
|
editable = current_user.has_permission(Permission.EditFormation)
|
||||||
table = sco_formations.formation_list_table()
|
table = sco_formations.formation_list_table(detail=detail)
|
||||||
|
|
||||||
if fmt != "html":
|
if fmt != "html":
|
||||||
return table.make_page(fmt=fmt, filename=f"Formations-{g.scodoc_dept}")
|
return table.make_page(fmt=fmt, filename=f"Formations-{g.scodoc_dept}")
|
||||||
|
|
||||||
H = [
|
H = [
|
||||||
html_sco_header.sco_header(page_title="Formations (programmes)"),
|
html_sco_header.sco_header(page_title="Formations (programmes)"),
|
||||||
"""<h2>Formations (programmes pédagogiques)</h2>
|
f"""<h2>Formations (programmes pédagogiques)</h2>
|
||||||
|
<form>
|
||||||
|
<input type="checkbox" id="detailCheckbox" name="detail"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
{'checked' if detail else ''}>
|
||||||
|
<label for="detailCheckbox">Informations détaillées</label>
|
||||||
|
</form>
|
||||||
""",
|
""",
|
||||||
table.html(),
|
table.html(),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user