Utiliser cette page pour éditer des versions provisoires des PV.
+ f"""
"""
)
else:
@@ -394,24 +404,28 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids: list[int] = None, etudid
submitlabel="Générer document",
name="tf",
formid="group_selector",
- html_foot_markup=menu_choix_groupe,
+ html_head_markup=menu_choix_groupe,
)
if tf[0] == 0:
+ info_etud = (
+ f"""de
{etud.nomprenom}"""
+ if etud
+ else ""
+ )
return render_template(
"sco_page.j2",
title=f"Édition du PV de jury {('de ' + etud.nom_prenom()) if etud else ''}",
content=f"""
"""
+ {info_etud}"""
+ "\n".join(H)
+ "\n"
+ tf[1]
+ "\n".join(F),
- javascripts=sco_groups_view.JAVASCRIPTS,
- cssstyles=sco_groups_view.CSSSTYLES,
+ javascripts=["js/groups_view.js"],
)
- elif tf[0] == -1:
+ if tf[0] == -1:
return flask.redirect(
url_for(
"notes.formsemestre_pvjury",
@@ -419,34 +433,34 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids: list[int] = None, etudid
formsemestre_id=formsemestre_id,
)
)
+
+ # submit
+ tf[2]["show_title"] = bool(tf[2]["show_title"])
+ tf[2]["anonymous"] = bool(tf[2]["anonymous"])
+ try:
+ PDFLOCK.acquire()
+ pdfdoc = sco_pv_pdf.pvjury_pdf(
+ formsemestre,
+ etudids,
+ numero_arrete=tf[2]["numero_arrete"],
+ code_vdi=tf[2]["code_vdi"],
+ date_commission=tf[2]["date_commission"],
+ date_jury=tf[2]["date_jury"],
+ show_title=tf[2]["show_title"],
+ pv_title_session=tf[2]["pv_title_session"],
+ pv_title=tf[2]["pv_title"],
+ with_paragraph_nom=tf[2]["with_paragraph_nom"],
+ anonymous=tf[2]["anonymous"],
+ )
+ finally:
+ PDFLOCK.release()
+ date_iso = time.strftime("%Y-%m-%d")
+ if groups_infos:
+ groups_filename = "-" + groups_infos.groups_filename
else:
- # submit
- tf[2]["show_title"] = bool(tf[2]["show_title"])
- tf[2]["anonymous"] = bool(tf[2]["anonymous"])
- try:
- PDFLOCK.acquire()
- pdfdoc = sco_pv_pdf.pvjury_pdf(
- formsemestre,
- etudids,
- numero_arrete=tf[2]["numero_arrete"],
- code_vdi=tf[2]["code_vdi"],
- date_commission=tf[2]["date_commission"],
- date_jury=tf[2]["date_jury"],
- show_title=tf[2]["show_title"],
- pv_title_session=tf[2]["pv_title_session"],
- pv_title=tf[2]["pv_title"],
- with_paragraph_nom=tf[2]["with_paragraph_nom"],
- anonymous=tf[2]["anonymous"],
- )
- finally:
- PDFLOCK.release()
- date_iso = time.strftime("%Y-%m-%d")
- if groups_infos:
- groups_filename = "-" + groups_infos.groups_filename
- else:
- groups_filename = ""
- filename = f"""PV-{formsemestre.titre_num()}{groups_filename}-{date_iso}.pdf"""
- return scu.sendPDFFile(pdfdoc, filename)
+ groups_filename = ""
+ filename = f"""PV-{formsemestre.titre_num()}{groups_filename}-{date_iso}.pdf"""
+ return scu.sendPDFFile(pdfdoc, filename)
def descrform_pvjury(formsemestre: FormSemestre):
@@ -542,9 +556,17 @@ def descrform_pvjury(formsemestre: FormSemestre):
]
-def formsemestre_lettres_individuelles(formsemestre_id, group_ids=()):
+def formsemestre_lettres_individuelles(formsemestre_id):
"Lettres avis jury en PDF"
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
+ if request.method == "POST":
+ group_ids = request.form.getlist("group_ids")
+ else:
+ group_ids = request.args.getlist("group_ids")
+ try:
+ group_ids = [int(gid) for gid in group_ids]
+ except ValueError as exc:
+ raise ScoValueError("group_ids invalide") from exc
if not group_ids:
# tous les inscrits du semestre
group_ids = [sco_groups.get_default_group(formsemestre_id)]
@@ -556,20 +578,22 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=()):
H = [
f"""
-
Utiliser cette page pour éditer des versions provisoires des PV.
+
+ Utiliser cette page pour éditer des versions provisoires des PV.
Il est recommandé d'archiver les versions définitives: voir cette page
+ >voir cette page
+
""",
]
descr = descrform_lettres_individuelles()
menu_choix_groupe = (
""""""
)
@@ -581,15 +605,14 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=()):
submitlabel="Générer document",
name="tf",
formid="group_selector",
- html_foot_markup=menu_choix_groupe,
+ html_head_markup=menu_choix_groupe,
)
if tf[0] == 0:
return render_template(
"sco_page.j2",
title="Édition des lettres individuelles",
content="\n".join(H) + "\n" + tf[1],
- javascripts=sco_groups_view.JAVASCRIPTS,
- cssstyles=sco_groups_view.CSSSTYLES,
+ javascripts=["js/groups_view.js"],
)
elif tf[0] == -1:
return flask.redirect(
diff --git a/app/scodoc/sco_report.py b/app/scodoc/sco_report.py
index 0984c8c3a..f234786ff 100644
--- a/app/scodoc/sco_report.py
+++ b/app/scodoc/sco_report.py
@@ -296,6 +296,14 @@ def formsemestre_report_counts(
sinon liste prédéfinie (voir ci-dessous)
"""
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
+ if request.method == "POST":
+ group_ids = request.form.getlist("group_ids")
+ else:
+ group_ids = request.args.getlist("group_ids")
+ try:
+ group_ids = [int(gid) for gid in group_ids]
+ except ValueError as exc:
+ raise ScoValueError("group_ids invalide") from exc
groups_infos = sco_groups_view.DisplayedGroupsInfos(
group_ids,
formsemestre_id=formsemestre.id,
@@ -420,8 +428,7 @@ def formsemestre_report_counts(
]
return render_template(
"sco_page.j2",
- cssstyles=sco_groups_view.CSSSTYLES,
- javascripts=sco_groups_view.JAVASCRIPTS,
+ javascripts=["js/groups_view.js"],
title=title,
content="\n".join(H),
)
@@ -740,7 +747,6 @@ def table_suivi_cohorte(
def formsemestre_suivi_cohorte(
formsemestre_id,
fmt="html",
- group_ids: list[int] = None, # si indiqué, ne prend que ces groupes
percent=1,
bac="",
bacspecialite="",
@@ -759,6 +765,14 @@ def formsemestre_suivi_cohorte(
raise ScoValueError("formsemestre_suivi_cohorte: argument invalide") from exc
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
+ if request.method == "POST":
+ group_ids = request.form.getlist("group_ids")
+ else:
+ group_ids = request.args.getlist("group_ids")
+ try:
+ group_ids = [int(gid) for gid in group_ids]
+ except ValueError as exc:
+ raise ScoValueError("group_ids invalide") from exc
groups_infos = sco_groups_view.DisplayedGroupsInfos(
group_ids,
formsemestre_id=formsemestre.id,
@@ -850,8 +864,7 @@ def formsemestre_suivi_cohorte(
]
return render_template(
"sco_page.j2",
- cssstyles=sco_groups_view.CSSSTYLES,
- javascripts=sco_groups_view.JAVASCRIPTS,
+ javascripts=["js/groups_view.js"],
title=tab.page_title,
content="\n".join(H),
)
@@ -1629,7 +1642,6 @@ def graph_cursus(
def formsemestre_graph_cursus(
formsemestre_id,
- group_ids: list[int] = None, # si indiqué, ne prend que ces groupes
fmt="html",
only_primo=False,
bac="", # selection sur type de bac
@@ -1644,6 +1656,15 @@ def formsemestre_graph_cursus(
annee_bac = str(annee_bac or "")
annee_admission = str(annee_admission or "")
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
+ if request.method == "POST":
+ group_ids = request.form.getlist("group_ids")
+ else:
+ group_ids = request.args.getlist("group_ids")
+ try:
+ group_ids = [int(gid) for gid in group_ids]
+ except ValueError as exc:
+ raise ScoValueError("group_ids invalide") from exc
+
groups_infos = sco_groups_view.DisplayedGroupsInfos(
group_ids,
formsemestre_id=formsemestre.id,
@@ -1781,8 +1802,7 @@ def formsemestre_graph_cursus(
]
return render_template(
"sco_page.j2",
- cssstyles=sco_groups_view.CSSSTYLES,
- javascripts=sco_groups_view.JAVASCRIPTS,
+ javascripts=["js/groups_view.js"],
page_title=f"Graphe cursus de {sem['titreannee']}",
no_sidebar=True,
content="\n".join(H),
diff --git a/app/scodoc/sco_saisie_excel.py b/app/scodoc/sco_saisie_excel.py
index 6aa6a86f9..f46d4a6dc 100644
--- a/app/scodoc/sco_saisie_excel.py
+++ b/app/scodoc/sco_saisie_excel.py
@@ -68,7 +68,9 @@ from app.views import ScoData
FONT_NAME = "Arial"
-def excel_feuille_saisie(evaluation: "Evaluation", rows: list[dict]) -> AnyStr:
+def excel_feuille_saisie(
+ evaluation: "Evaluation", rows: list[dict], groups_titles: str = ""
+) -> AnyStr:
"""Génère feuille excel pour saisie des notes dans l'evaluation
- evaluation
- rows: liste de dict
@@ -77,7 +79,9 @@ def excel_feuille_saisie(evaluation: "Evaluation", rows: list[dict]) -> AnyStr:
"""
ws = ScoExcelSheet("Saisie notes")
styles = _build_styles()
- nb_lines_titles = _insert_top_title(ws, styles, evaluation=evaluation)
+ nb_lines_titles = _insert_top_title(
+ ws, styles, evaluation=evaluation, groups_titles=groups_titles
+ )
_insert_line_titles(
ws,
@@ -263,6 +267,7 @@ def _insert_top_title(
evaluation: Evaluation | None = None,
formsemestre: FormSemestre | None = None,
description="",
+ groups_titles: str = "",
) -> int:
"""Insère les lignes de titre de la feuille (suivies d'une ligne blanche).
Si evaluation, indique son titre.
@@ -298,7 +303,7 @@ def _insert_top_title(
evaluation.moduleimpl.formsemestre.titre_annee()
if evaluation
else (formsemestre.titre_annee() if formsemestre else "")
- )
+ ) + ((" - " + groups_titles) if groups_titles else "")
ws.append_single_cell_row(
scu.unescape_html(titre_annee), styles["titres"], prefix=[""]
)
@@ -372,15 +377,16 @@ def _insert_bottom_help(ws, styles: dict):
)
-def feuille_saisie_notes(
- evaluation_id, group_ids: list[int] = None
-): # TODO ré-écrire et passer dans notes.py
+def feuille_saisie_notes(evaluation_id: int): # TODO ré-écrire et passer dans notes.py
"""Vue: document Excel pour saisie notes dans l'évaluation et les groupes indiqués"""
evaluation = Evaluation.get_evaluation(evaluation_id)
- group_ids = group_ids or []
+ group_ids = request.args.getlist("group_ids") or []
+ try:
+ group_ids = [int(gid) for gid in group_ids]
+ except ValueError as exc:
+ raise ScoValueError("group_ids invalide") from exc
modimpl = evaluation.moduleimpl
formsemestre = modimpl.formsemestre
-
if evaluation.date_debut:
indication_date = evaluation.date_debut.date().isoformat()
else:
@@ -430,7 +436,9 @@ def feuille_saisie_notes(
eval_name = f"{evaluation.moduleimpl.module.code}-{indication_date}"
filename = f"notes_{eval_name}_{gr_title_filename}"
- xls = excel_feuille_saisie(evaluation, rows=rows)
+ xls = excel_feuille_saisie(
+ evaluation, rows=rows, groups_titles=groups_infos.groups_titles
+ )
return scu.send_file(xls, filename, scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE)
@@ -962,9 +970,14 @@ def _get_sheet_evaluations(
raise ValueError("_get_sheet_evaluations")
-def saisie_notes_tableur(evaluation_id: int, group_ids=()):
+def saisie_notes_tableur(evaluation_id: int):
"""Saisie des notes via un fichier Excel"""
- evaluation = Evaluation.query.get_or_404(evaluation_id)
+ group_ids = request.args.getlist("group_ids")
+ try:
+ group_ids = [int(gid) for gid in group_ids]
+ except ValueError as exc:
+ raise ScoValueError("group_ids invalide") from exc
+ evaluation = Evaluation.get_evaluation(evaluation_id)
moduleimpl_id = evaluation.moduleimpl.id
formsemestre_id = evaluation.moduleimpl.formsemestre_id
if not evaluation.moduleimpl.can_edit_notes(current_user):
@@ -1004,18 +1017,20 @@ def saisie_notes_tableur(evaluation_id: int, group_ids=()):
# Menu choix groupe:
H.append("""
""")
- H.append(sco_groups_view.form_groups_choice(groups_infos))
+ H.append(sco_groups_view.form_groups_choice(groups_infos, submit_on_change=True))
H.append(" |
")
H.append(
f"""
Étape 1 :
@@ -1085,7 +1100,7 @@ def saisie_notes_tableur(evaluation_id: int, group_ids=()):
scodoc_dept=g.scodoc_dept, evaluation_id=evaluation.id)
}">Charger un autre fichier de notes
-
Formulaire de saisie des notes
"""
@@ -1113,7 +1128,9 @@ def saisie_notes_tableur(evaluation_id: int, group_ids=()):
-
-
- - Revenir au formulaire de saisie
@@ -1176,8 +1193,7 @@ def saisie_notes_tableur(evaluation_id: int, group_ids=()):
"sco_page.j2",
content="\n".join(H),
page_title=page_title,
- javascripts=sco_groups_view.JAVASCRIPTS,
- cssstyles=sco_groups_view.CSSSTYLES,
+ javascripts=["js/groups_view.js"],
)
diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py
index 3eb0b346f..10dfed91e 100644
--- a/app/scodoc/sco_saisie_notes.py
+++ b/app/scodoc/sco_saisie_notes.py
@@ -54,7 +54,6 @@ from app.scodoc.sco_exceptions import (
AccessDenied,
NoteProcessError,
ScoException,
- ScoInvalidParamError,
ScoValueError,
)
from app.scodoc import htmlutils
@@ -71,6 +70,7 @@ from app.scodoc.TrivialFormulator import TF
import app.scodoc.sco_utils as scu
from app.scodoc.sco_utils import json_error
from app.scodoc.sco_utils import ModuleType
+from app.views import ScoData
def convert_note_from_string(
@@ -212,7 +212,7 @@ def do_evaluation_set_missing(
evaluation_id, value, dialog_confirmed=False, group_ids_str: str = ""
):
"""Initialisation des notes manquantes"""
- evaluation = Evaluation.query.get_or_404(evaluation_id)
+ evaluation = Evaluation.get_evaluation(evaluation_id)
modimpl = evaluation.moduleimpl
# Check access
# (admin, respformation, and responsable_id)
@@ -222,8 +222,12 @@ def do_evaluation_set_missing(
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
if not group_ids_str:
groups = None
+ groups_infos = None
else:
group_ids = [int(x) for x in str(group_ids_str).split(",")]
+ groups_infos = sco_groups_view.DisplayedGroupsInfos(
+ group_ids, formsemestre_id=modimpl.formsemestre.id
+ )
groups = sco_groups.listgroups(group_ids)
etudid_etats = sco_groups.do_evaluation_listeetuds_groups(
@@ -240,7 +244,9 @@ def do_evaluation_set_missing(
# Convert and check values
valid_notes, invalids, _, _, _ = check_notes(notes, evaluation)
dest_url = url_for(
- "notes.saisie_notes", scodoc_dept=g.scodoc_dept, evaluation_id=evaluation_id
+ "notes.form_saisie_notes",
+ scodoc_dept=g.scodoc_dept,
+ evaluation_id=evaluation_id,
)
diag = ""
if len(invalids) > 0:
@@ -260,12 +266,17 @@ def do_evaluation_set_missing(
plural = len(valid_notes) > 1
return scu.confirm_dialog(
f"""Mettre toutes les notes manquantes de l'évaluation
- à la valeur {value} ?
+ à la valeur {value} / {evaluation.note_max:g} ?
Seuls les étudiants pour lesquels aucune note (ni valeur, ni ABS, ni EXC)
n'a été rentrée seront affectés.
- {len(valid_notes)} étudiant{"s" if plural else ""} concerné{"s" if plural else ""}
+
+ Groupes: {groups_infos.groups_titles if groups_infos else "tous"},
+ dont
+
+ {len(valid_notes)} étudiant{"s" if plural else ""} concerné{"s" if plural else ""}
+
par ce changement de note.
-
+
""",
dest_url="",
cancel_url=dest_url,
@@ -624,14 +635,8 @@ def _record_note(
# Nouveau formulaire saisie notes (2016)
-def saisie_notes(evaluation_id: int, group_ids: list = None):
+def saisie_notes(evaluation: Evaluation, group_ids: list[int] | tuple[int] = ()):
"""Formulaire saisie notes d'une évaluation pour un groupe"""
- if not isinstance(evaluation_id, int):
- raise ScoInvalidParamError()
- group_ids = [int(group_id) for group_id in (group_ids or [])]
- evaluation: Evaluation = db.session.get(Evaluation, evaluation_id)
- if evaluation is None:
- raise ScoValueError("évaluation inexistante")
modimpl = evaluation.moduleimpl
moduleimpl_status_url = url_for(
"notes.moduleimpl_status",
@@ -660,7 +665,6 @@ def saisie_notes(evaluation_id: int, group_ids: list = None):
select_all_when_unspecified=True,
etat=None,
)
-
page_title = (
f'Saisie "{evaluation.description}"'
if evaluation.description
@@ -669,12 +673,12 @@ def saisie_notes(evaluation_id: int, group_ids: list = None):
# HTML page:
H = [
sco_evaluations.evaluation_describe(
- evaluation_id=evaluation_id, link_saisie=False
+ evaluation_id=evaluation.id, link_saisie=False
),
'Saisie des notes',
]
H.append("""
""")
- H.append(sco_groups_view.form_groups_choice(groups_infos))
+ H.append(sco_groups_view.form_groups_choice(groups_infos, submit_on_change=True))
H.append(' | ')
H.append(
htmlutils.make_menu(
@@ -755,7 +759,8 @@ def saisie_notes(evaluation_id: int, group_ids: list = None):
"sco_page.j2",
content="\n".join(H),
title=page_title,
- javascripts=["js/saisie_notes.js"],
+ javascripts=["js/groups_view.js", "js/saisie_notes.js"],
+ sco=ScoData(formsemestre=modimpl.formsemestre),
)
@@ -839,11 +844,15 @@ def _form_saisie_notes(
"""
formsemestre_id = modimpl.formsemestre_id
formsemestre: FormSemestre = evaluation.moduleimpl.formsemestre
+ groups = sco_groups.listgroups(groups_infos.group_ids)
res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
etudids = [
x[0]
for x in sco_groups.do_evaluation_listeetuds_groups(
- evaluation.id, getallstudents=True, include_demdef=True
+ evaluation.id,
+ groups=groups,
+ getallstudents=groups is None,
+ include_demdef=True,
)
]
if not etudids:
@@ -1001,7 +1010,9 @@ def _form_saisie_notes(
H.append(
f"""
|